[ElmSharp] Add Popup TC 05/165405/1
authordarkleem <cdark.lim@samsung.com>
Fri, 29 Dec 2017 01:47:22 +0000 (10:47 +0900)
committerdarkleem <cdark.lim@samsung.com>
Fri, 29 Dec 2017 01:47:30 +0000 (10:47 +0900)
Change-Id: I0a7a178b8de592a71db567d6b3dbe7a094cfee4e

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

diff --git a/test/ElmSharp.Test/TC/PopupTest4.cs b/test/ElmSharp.Test/TC/PopupTest4.cs
new file mode 100644 (file)
index 0000000..98de89e
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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 PopupTest4 : TestCaseBase
+    {
+        public override string TestName => "PopupTest4";
+        public override string TestDescription => "To test basic operation of Popup with DateTimeSelector timeStyle";
+
+        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();
+
+            Button btn2 = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "set now"
+            };
+            btn2.Show();
+
+            Popup popup = new Popup(window);
+            DateTimeSelector dateTime = new DateTimeSelector(window)
+            {
+                Style = "time_layout",
+                Format = "%d/%b/%Y %I:%M %p",
+                DateTime = DateTime.Now
+            };
+            popup.SetPartContent("default", dateTime, true);
+
+            btn.Clicked += (s, e) =>
+            {
+                popup.Show();
+            };
+
+            btn2.Clicked += (s, e) =>
+            {
+                btn.Text = DateTime.Now.ToString("t");
+                dateTime.DateTime = DateTime.Now;
+            };
+
+            Button close = new Button(popup)
+            {
+                Text = "Close"
+            };
+            popup.SetPartContent("button1", close, true);
+
+            Button ok = new Button(popup)
+            {
+                Text = "Ok"
+            };
+            popup.SetPartContent("button3", ok, true);
+
+            ok.Clicked += (s, e) =>
+            {
+                btn.Text = dateTime.DateTime.ToString("t");
+                popup.Hide();
+            };
+
+            close.Clicked += (s, e) =>
+            {
+                popup.Hide();
+            };
+
+            box.PackEnd(btn);
+            box.PackEnd(btn2);
+
+            conformant.SetContent(box);
+        }
+    }
+}