[ElmSharp.Wearable]add Activate() and fix tc
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Wearable.Test / TC / CircleDateTimeSelectorTest3.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using ElmSharp.Wearable;
19
20 namespace ElmSharp.Test.TC
21 {
22     class CircleDateTimeSelectorTest3 : TestCaseBase
23     {
24         public override string TestName => "CircleDateTimeSelectorTest3";
25         public override string TestDescription => "To display a date time selector with circle UI";
26
27         public override void Run(Window window)
28         {
29             Conformant conformant = new Conformant(window);
30             conformant.Show();
31
32             Layout layout = new Layout(window);
33
34             layout.SetTheme("layout", "circle", "datetime");
35
36             conformant.SetContent(layout);
37
38             var surface = new CircleSurface(conformant);
39
40             var datetime = new CircleDateTimeSelector(conformant, surface)
41             {
42                 DateTime = DateTime.Now,
43                 Style = "timepicker/circle",
44                 IsEnabled = false
45             };
46             ((IRotaryActionWidget)datetime).Activate();
47             layout.SetContent(datetime);
48
49             Button btn = new Button(layout)
50             {
51                 Text = "OK",
52                 Style = "bottom",
53             };
54
55             layout.SetPartContent("elm.swallow.btn", btn);
56
57             layout.SetPartText("elm.text", "Set time");
58
59             datetime.DateTimeChanged += (object sender, DateChangedEventArgs e) =>
60             {
61                 Log.Debug(TestName, "Old DateTime={0}", e.OldDate.ToString());
62                 Log.Debug(TestName, "New DateTime={0}", e.NewDate.ToString());
63                 Log.Debug(TestName, "Current DateTime={0}", datetime.DateTime.ToString());
64             };
65         }
66     }
67 }