Add Clipper TC
authorSeungkeun Lee <sngn.lee@samsung.com>
Thu, 27 Oct 2016 07:08:10 +0000 (16:08 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Thu, 27 Oct 2016 07:08:10 +0000 (16:08 +0900)
 - Clipper was blend with others widgets

Change-Id: I4d7fa9cca866eacbe5a8d6de15dbca1c4d568cc3

test/ElmSharp.Test/ElmSharp.Test.csproj
test/ElmSharp.Test/TC/ClipperTest1.cs [new file with mode: 0644]

index 977d0d3..8d9dedf 100644 (file)
@@ -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" />
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/test/ElmSharp.Test/TC/ClipperTest1.cs b/test/ElmSharp.Test/TC/ClipperTest1.cs
new file mode 100644 (file)
index 0000000..af9cc76
--- /dev/null
@@ -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);
+        }
+    }
+}