diff options
-rw-r--r-- | ElmSharp.Test/ElmSharp.Test.csproj | 3 | ||||
-rw-r--r-- | ElmSharp.Test/TC/ClipperTest1.cs | 73 |
2 files changed, 75 insertions, 1 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj index 977d0d3..8d9dedf 100644 --- a/ElmSharp.Test/ElmSharp.Test.csproj +++ b/ElmSharp.Test/ElmSharp.Test.csproj @@ -48,6 +48,7 @@ <Compile Include="TC\ButtonTest1.cs" /> <Compile Include="TC\CalendarTest1.cs" /> <Compile Include="TC\CheckTest1.cs" /> + <Compile Include="TC\ClipperTest1.cs" /> <Compile Include="TC\ColorSelectorTest1.cs" /> <Compile Include="TC\ContextPopupTest1.cs" /> <Compile Include="TC\DateTimeSelectorTest1.cs" /> @@ -177,4 +178,4 @@ </FlavorProperties> </VisualStudio> </ProjectExtensions> -</Project> +</Project>
\ No newline at end of file diff --git a/ElmSharp.Test/TC/ClipperTest1.cs b/ElmSharp.Test/TC/ClipperTest1.cs new file mode 100644 index 0000000..af9cc76 --- /dev/null +++ b/ElmSharp.Test/TC/ClipperTest1.cs @@ -0,0 +1,73 @@ +using System; +using ElmSharp; + +namespace ElmSharp.Test +{ + public class ClipperTest1 : TestCaseBase + { + public override string TestName => "ClipperTest1"; + public override string TestDescription => "ClipperTest1 test"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Naviframe navi = new Naviframe(window) + { + PreserveContentOnPop = true, + DefaultBackButtonEnabled = true + }; + + Scroller scroller = new Scroller(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + ScrollBlock = ScrollBlock.None, + }; + scroller.Show(); + Box container = new Box(window); + scroller.SetContent(container); + + var rect1 = new Rectangle(window) + { + AlignmentX = -1, + WeightX = 1, + Color = Color.Blue, + MinimumHeight = 500 + }; + rect1.Show(); + + var clipper = new Rectangle(window); + clipper.Color = new ElmSharp.Color(200, 200, 200, 200); + clipper.Geometry = rect1.Geometry; + rect1.Moved += (s, e) => + { + clipper.Geometry = ((Rectangle)s).Geometry; + }; + rect1.SetClip(clipper); + clipper.Show(); + container.PackEnd(rect1); + + Color[] colors = { Color.Red, Color.Olive, Color.Green, Color.Gray, Color.Lime, Color.Maroon }; + for (int i = 0; i < 6; i++) + { + var rect = new Rectangle(window) + { + AlignmentX = -1, + WeightX = 1, + Color = colors[i], + MinimumHeight = 500 + }; + rect.Show(); + container.PackEnd(rect); + } + + navi.Push(scroller, "Scroll Page"); + navi.Show(); + conformant.SetContent(navi); + } + } +} |