[ElmSharp] Add ElmSharp TCs to check Popup functionalities 02/161902/3 5.0.0-preview1-00392
authorKangho Hur <kangho.hur@samsung.com>
Tue, 28 Nov 2017 06:24:32 +0000 (15:24 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Tue, 28 Nov 2017 06:26:55 +0000 (06:26 +0000)
Change-Id: I7de5b8c0de95fd102f85bf58463d25c3436933a4

test/ElmSharp.Test/TC/PopupTest2.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/PopupTest3.cs [new file with mode: 0644]

diff --git a/test/ElmSharp.Test/TC/PopupTest2.cs b/test/ElmSharp.Test/TC/PopupTest2.cs
new file mode 100644 (file)
index 0000000..9d6fdeb
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using ElmSharp;
+
+namespace ElmSharp.Test
+{
+    public class PopupTest2 : TestCaseBase
+    {
+        public override string TestName => "PopupTest2";
+        public override string TestDescription => "To test basic operation of Toast Popup";
+
+        public override void Run(Window window)
+        {
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+            Box box = new Box(window);
+            box.Show();
+            Button btn = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "Show Toast"
+            };
+            btn.Show();
+
+            Popup popup = new Popup(window)
+            {
+                Orientation = PopupOrientation.Bottom,
+                Timeout = 5,
+                Style = "toast",
+                Text = "This is a toast popup"
+            };
+
+            popup.Dismissed += (s, e) =>
+            {
+                Console.WriteLine("Popup dismissed");
+            };
+
+            popup.ShowAnimationFinished += (s, e) =>
+            {
+                Console.WriteLine("Popup show animation finished");
+            };
+
+            popup.OutsideClicked += (s, e) =>
+            {
+                Console.WriteLine("Popup outside clicked");
+            };
+
+            popup.TimedOut += (s, e) =>
+            {
+                Console.WriteLine("Popup time out");
+            };
+
+            btn.Clicked += (s, e) =>
+            {
+                popup.Show();
+            };
+
+            box.PackEnd(btn);
+            conformant.SetContent(box);
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/PopupTest3.cs b/test/ElmSharp.Test/TC/PopupTest3.cs
new file mode 100644 (file)
index 0000000..eb17371
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using ElmSharp;
+
+namespace ElmSharp.Test
+{
+    public class PopupTest3 : TestCaseBase
+    {
+        public override string TestName => "PopupTest3";
+        public override string TestDescription => "To test basic operation of Popup with DateTimeSelector";
+
+        public override void Run(Window window)
+        {
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+            Box box = new Box(window);
+            box.Show();
+            Button btn = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "Open"
+            };
+            btn.Show();
+
+            Popup popup = new Popup(window);
+            DateTimeSelector dateTime = new DateTimeSelector(window)
+            {
+                MinimumDateTime = new DateTime(2015, 1, 1),
+                MaximumDateTime = DateTime.Now,
+                DateTime = DateTime.Now
+            };
+            popup.SetPartContent("default", dateTime, true);
+
+            popup.Dismissed += (s, e) =>
+            {
+                Console.WriteLine("Popup dismissed");
+            };
+
+            popup.ShowAnimationFinished += (s, e) =>
+            {
+                Console.WriteLine("Popup show animation finished");
+            };
+
+            popup.OutsideClicked += (s, e) =>
+            {
+                Console.WriteLine("Popup outside clicked");
+            };
+
+            popup.TimedOut += (s, e) =>
+            {
+                Console.WriteLine("Popup time out");
+            };
+
+            popup.BackButtonPressed += (s, e) =>
+            {
+                Console.WriteLine("!!! BackButtonPressed Event on Popup!!");
+                popup.Hide();
+            };
+
+            btn.Clicked += (s, e) =>
+            {
+                popup.Show();
+            };
+
+            Button close = new Button(popup)
+            {
+                Text = "Close"
+            };
+            popup.SetPartContent("button1", close, true);
+
+            Button ok = new Button(popup)
+            {
+                Text = "Ok"
+            };
+            popup.SetPartContent("button3", ok, true);
+
+            close.Clicked += (s, e) =>
+            {
+                popup.Hide();
+            };
+
+            box.PackEnd(btn);
+            conformant.SetContent(box);
+        }
+    }
+}