From 1787f499330ffa561147fb17f23acfd085cfd9d7 Mon Sep 17 00:00:00 2001 From: darkleem Date: Fri, 29 Dec 2017 10:47:22 +0900 Subject: [PATCH] [ElmSharp] Add Popup TC Change-Id: I0a7a178b8de592a71db567d6b3dbe7a094cfee4e --- test/ElmSharp.Test/TC/PopupTest4.cs | 98 +++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 test/ElmSharp.Test/TC/PopupTest4.cs diff --git a/test/ElmSharp.Test/TC/PopupTest4.cs b/test/ElmSharp.Test/TC/PopupTest4.cs new file mode 100644 index 0000000..98de89e --- /dev/null +++ b/test/ElmSharp.Test/TC/PopupTest4.cs @@ -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); + } + } +} -- 2.7.4