Release 9.0.0.16429
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Application / TSWatchTime.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Threading.Tasks;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("public/Application/WatchTime")]
14     public class PublicWatchTimeTest
15     {
16         private const string tag = "NUITEST";
17
18         private bool IsWearable()
19         {
20             string value;
21             var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
22             if (result && value.Equals("wearable"))
23             {
24                 return true;
25             }
26
27             return false;
28         }
29
30         [SetUp]
31         public void Init()
32         {
33             tlog.Info(tag, "Init() is called!");
34         }
35
36         [TearDown]
37         public void Destroy()
38         {
39             tlog.Info(tag, "Destroy() is called!");
40         }
41
42         [Test]
43         [Category("P1")]
44         [Description("WatchTime constructor.")]
45         [Property("SPEC", "Tizen.NUI.WatchTime.WatchTime C")]
46         [Property("SPEC_URL", "-")]
47         [Property("CRITERIA", "CONSTR")]
48         [Property("AUTHOR", "guowei.wang@samsung.com")]
49         public void WatchTimeConstructor()
50         {
51             tlog.Debug(tag, $"WatchTimeConstructor START");
52
53             if (IsWearable())
54             {
55                 var testingTarget = new WatchTime();
56                 Assert.IsNotNull(testingTarget, "should be not null");
57                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
58
59                 testingTarget.Dispose();
60                 tlog.Debug(tag, $"WatchTimeConstructor END (OK)");
61             }
62             else
63             {
64                 tlog.Debug(tag, $"WatchTimeConstructor END (OK)");
65                 Assert.Pass("Not Supported profile");
66             }
67         }
68
69         [Test]
70         [Category("P1")]
71         [Description("WatchTime Day.")]
72         [Property("SPEC", "Tizen.NUI.WatchTime.Day A")]
73         [Property("SPEC_URL", "-")]
74         [Property("CRITERIA", "PRO")]
75         [Property("AUTHOR", "guowei.wang@samsung.com")]
76         public void WatchTimeDay()
77         {
78             tlog.Debug(tag, $"WatchTimeDay START");
79
80             if (IsWearable())
81             {
82                 var testingTarget = new WatchTime();
83                 Assert.IsNotNull(testingTarget, "should be not null");
84                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
85                 
86                 int time = testingTarget.Day;
87                 Assert.IsTrue(time > 0.0f);
88
89                 testingTarget.Dispose();
90                 tlog.Debug(tag, $"WatchTimeDay END (OK)");
91             }
92             else
93             {
94                 tlog.Debug(tag, $"WatchTimeDay END (OK)");
95                 Assert.Pass("Not Supported profile");
96             }
97         }
98
99         [Test]
100         [Category("P1")]
101         [Description("WatchTime DaylightSavingTimeStatus.")]
102         [Property("SPEC", "Tizen.NUI.WatchTime.DaylightSavingTimeStatus A")]
103         [Property("SPEC_URL", "-")]
104         [Property("CRITERIA", "PRO")]
105         [Property("AUTHOR", "guowei.wang@samsung.com")]
106         public void WatchTimeDaylightSavingTimeStatus()
107         {
108             tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus START");
109
110             if (IsWearable())
111             {
112                 var testingTarget = new WatchTime();
113                 Assert.IsNotNull(testingTarget, "should be not null");
114                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
115                 
116                 bool status = testingTarget.DaylightSavingTimeStatus;
117                 Assert.AreEqual(false, status, "Should be the default value");
118
119                 testingTarget.Dispose();
120                 tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus END (OK)");
121             }
122             else
123             {
124                 tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus END (OK)");
125                 Assert.Pass("Not Supported profile");
126             }
127         }
128
129         [Test]
130         [Category("P1")]
131         [Description("WatchTime DayOfWeek.")]
132         [Property("SPEC", "Tizen.NUI.WatchTime.DayOfWeek A")]
133         [Property("SPEC_URL", "-")]
134         [Property("CRITERIA", "PRO")]
135         [Property("AUTHOR", "guowei.wang@samsung.com")]
136         public void WatchTimeDayOfWeek()
137         {
138             tlog.Debug(tag, $"WatchTimeDayOfWeek START");
139
140             if (IsWearable())
141             {
142                 var testingTarget = new WatchTime();
143                 Assert.IsNotNull(testingTarget, "should be not null");
144                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
145
146                 int day = testingTarget.DayOfWeek;
147                 Assert.IsTrue(day > 0.0f);
148
149                 testingTarget.Dispose();
150                 tlog.Debug(tag, $"WatchTimeDayOfWeek END (OK)");
151             }
152             else
153             {
154                 tlog.Debug(tag, $"WatchTimeDayOfWeek END (OK)");
155                 Assert.Pass("Not Supported profile");
156             }
157         }
158
159         [Test]
160         [Category("P1")]
161         [Description("WatchTime Hour.")]
162         [Property("SPEC", "Tizen.NUI.WatchTime.Hour A")]
163         [Property("SPEC_URL", "-")]
164         [Property("CRITERIA", "PRO")]
165         [Property("AUTHOR", "guowei.wang@samsung.com")]
166         public void WatchTimeHour()
167         {
168             tlog.Debug(tag, $"WatchTimeHour START");
169
170             if (IsWearable())
171             {
172                 var testingTarget = new WatchTime();
173                 Assert.IsNotNull(testingTarget, "should be not null");
174                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
175
176                 int hour = testingTarget.Hour;
177                 Assert.IsTrue(hour > 0.0f);
178
179                 testingTarget.Dispose();
180                 tlog.Debug(tag, $"WatchTimeHour END (OK)");
181             }
182             else
183             {
184                 tlog.Debug(tag, $"WatchTimeHour END (OK)");
185                 Assert.Pass("Not Supported profile");
186             }
187         }
188
189         [Test]
190         [Category("P1")]
191         [Description("WatchTime Hour24.")]
192         [Property("SPEC", "Tizen.NUI.WatchTime.Hour24 A")]
193         [Property("SPEC_URL", "-")]
194         [Property("CRITERIA", "PRO")]
195         [Property("AUTHOR", "guowei.wang@samsung.com")]
196         public void WatchTimeHour24()
197         {
198             tlog.Debug(tag, $"WatchTimeHour24 START");
199
200             if (IsWearable())
201             {
202                 var testingTarget = new WatchTime();
203                 Assert.IsNotNull(testingTarget, "should be not null");
204                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
205
206                 int hour24 = testingTarget.Hour24;
207                 Assert.IsTrue(hour24 >= 0.0f);
208
209                 testingTarget.Dispose();
210                 tlog.Debug(tag, $"WatchTimeHour24 END (OK)");
211             }
212             else
213             {
214                 tlog.Debug(tag, $"WatchTimeHour24 END (OK)");
215                 Assert.Pass("Not Supported profile");
216             }
217         }
218
219         [Test]
220         [Category("P1")]
221         [Description("WatchTime Millisecond.")]
222         [Property("SPEC", "Tizen.NUI.WatchTime.Millisecond A")]
223         [Property("SPEC_URL", "-")]
224         [Property("CRITERIA", "PRO")]
225         [Property("AUTHOR", "guowei.wang@samsung.com")]
226         public void WatchTimeMillisecond()
227         {
228             tlog.Debug(tag, $"WatchTimeMillisecond START");
229
230             if (IsWearable())
231             {
232                 var testingTarget = new WatchTime();
233                 Assert.IsNotNull(testingTarget, "should be not null");
234                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
235
236                 int millisecond = testingTarget.Millisecond;
237                 Assert.IsTrue(millisecond >= 0.0f);
238
239                 testingTarget.Dispose();
240                 tlog.Debug(tag, $"WatchTimeMillisecond END (OK)");
241             }
242             else
243             {
244                 tlog.Debug(tag, $"WatchTimeMillisecond END (OK)");
245                 Assert.Pass("Not Supported profile");
246             }
247         }
248
249         [Test]
250         [Category("P1")]
251         [Description("WatchTime Minute.")]
252         [Property("SPEC", "Tizen.NUI.WatchTime.Minute A")]
253         [Property("SPEC_URL", "-")]
254         [Property("CRITERIA", "PRO")]
255         [Property("AUTHOR", "guowei.wang@samsung.com")]
256         public void WatchTimeMinute()
257         {
258             tlog.Debug(tag, $"WatchTimeMinute START");
259
260             if (IsWearable())
261             {
262                 var testingTarget = new WatchTime();
263                 Assert.IsNotNull(testingTarget, "should be not null");
264                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
265
266                 int minute = testingTarget.Minute;
267                 Assert.IsTrue(minute >= 0.0f);
268
269                 testingTarget.Dispose();
270                 tlog.Debug(tag, $"WatchTimeMinute END (OK)");
271             }
272             else
273             {
274                 tlog.Debug(tag, $"WatchTimeMinute END (OK)");
275                 Assert.Pass("Not Supported profile");
276             }
277         }
278
279         [Test]
280         [Category("P1")]
281         [Description("WatchTime Month.")]
282         [Property("SPEC", "Tizen.NUI.WatchTime.Month A")]
283         [Property("SPEC_URL", "-")]
284         [Property("CRITERIA", "PRO")]
285         [Property("AUTHOR", "guowei.wang@samsung.com")]
286         public void WatchTimeMonth()
287         {
288             tlog.Debug(tag, $"WatchTimeMonth START");
289
290             if (IsWearable())
291             {
292                 var testingTarget = new WatchTime();
293                 Assert.IsNotNull(testingTarget, "should be not null");
294                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
295
296                 int month = testingTarget.Month;
297                 Assert.IsTrue(month > 0.0f);
298
299                 testingTarget.Dispose();
300                 tlog.Debug(tag, $"WatchTimeMonth END (OK)");
301             }
302             else
303             {
304                 tlog.Debug(tag, $"WatchTimeMonth END (OK)");
305                 Assert.Pass("Not Supported profile");
306             }
307         }
308
309         [Test]
310         [Category("P1")]
311         [Description("WatchTime Second.")]
312         [Property("SPEC", "Tizen.NUI.WatchTime.Second A")]
313         [Property("SPEC_URL", "-")]
314         [Property("CRITERIA", "PRO")]
315         [Property("AUTHOR", "guowei.wang@samsung.com")]
316         public void WatchTimeSecond()
317         {
318             tlog.Debug(tag, $"WatchTimeSecond START");
319
320             if (IsWearable())
321             {
322                 var testingTarget = new WatchTime();
323                 Assert.IsNotNull(testingTarget, "should be not null");
324                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
325
326                 int second = testingTarget.Second;
327                 Assert.IsTrue(second >= 0.0f);
328
329                 testingTarget.Dispose();
330                 tlog.Debug(tag, $"WatchTimeSecond END (OK)");
331             }
332             else
333             {
334                 tlog.Debug(tag, $"WatchTimeSecond END (OK)");
335                 Assert.Pass("Not Supported profile");
336             }
337         }
338
339         [Test]
340         [Category("P1")]
341         [Description("WatchTime TimeZone.")]
342         [Property("SPEC", "Tizen.NUI.WatchTime.TimeZone A")]
343         [Property("SPEC_URL", "-")]
344         [Property("CRITERIA", "PRO")]
345         [Property("AUTHOR", "guowei.wang@samsung.com")]
346         public void WatchTimeTimeZone()
347         {
348             tlog.Debug(tag, $"WatchTimeTimeZone START");
349
350             if (IsWearable())
351             {
352                 var testingTarget = new WatchTime();
353                 Assert.IsNotNull(testingTarget, "should be not null");
354                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
355
356                 string zone = testingTarget.TimeZone;
357                 Assert.IsNotEmpty(zone, "TimeZone is empty");
358
359                 testingTarget.Dispose();
360                 tlog.Debug(tag, $"WatchTimeTimeZone END (OK)");
361             }
362             else
363             {
364                 tlog.Debug(tag, $"WatchTimeTimeZone END (OK)");
365                 Assert.Pass("Not Supported profile");
366             }
367         }
368
369         [Test]
370         [Category("P1")]
371         [Description("WatchTime Year.")]
372         [Property("SPEC", "Tizen.NUI.WatchTime.Year A")]
373         [Property("SPEC_URL", "-")]
374         [Property("CRITERIA", "PRO")]
375         [Property("AUTHOR", "guowei.wang@samsung.com")]
376         public void WatchTimeYear()
377         {
378             tlog.Debug(tag, $"WatchTimeYear START");
379
380             if (IsWearable())
381             {
382                 var testingTarget = new WatchTime();
383                 Assert.IsNotNull(testingTarget, "should be not null");
384                 Assert.IsInstanceOf<WatchTime>(testingTarget, "Should be an instance of WatchTime type.");
385
386                 int year = testingTarget.Year;
387                 Assert.IsTrue(year > 0.0f);
388
389                 testingTarget.Dispose();
390                 tlog.Debug(tag, $"WatchTimeYear END (OK)");
391             }
392             else
393             {
394                 tlog.Debug(tag, $"WatchTimeYear END (OK)");
395                 Assert.Pass("Not Supported profile");
396             }
397         }
398     }
399 }