Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Application / TSNUIFrameComponent.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
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("public/Application/NUIFrameComponent")]
13     class PublicNUIFrameComponentTest
14     {
15         private const string tag = "NUITEST";
16
17         internal class MyNUIFrameComponent : NUIFrameComponent
18         {
19             public MyNUIFrameComponent() : base()
20             { }
21
22             public void MyOnCreate()
23             {
24                 base.OnCreate();
25             }
26
27             public void MyOnStart(Tizen.Applications.AppControl appControl, bool restarted)
28             {
29                 base.OnStart(appControl, restarted);
30             }
31
32             public void MyOnResume()
33             {
34                 base.OnResume();
35             }
36
37             public void MyOnPause()
38             {
39                 base.OnPause();
40             }
41
42             public void MyOnStop()
43             {
44                 base.OnStop();
45             }
46
47             public void MyOnDestroy()
48             {
49                 base.OnDestroy();
50             }
51         }
52
53         [SetUp]
54         public void Init()
55         {
56             tlog.Info(tag, "Init() is called!");
57         }
58
59         [TearDown]
60         public void Destroy()
61         {
62             tlog.Info(tag, "Destroy() is called!");
63         }
64
65         [Test]
66         [Category("P1")]
67         [Description("NUIFrameComponent NUIWindowInfo")]
68         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.NUIWindowInfo A")]
69         [Property("SPEC_URL", "-")]
70         [Property("CRITERIA", "PRW")]
71         [Property("AUTHOR", "guowei.wang@samsung.com")]
72         public void NUIFrameComponentNUIWindowInfo()
73         {
74             tlog.Debug(tag, $"NUIFrameComponentNUIWindowInfo START");
75
76             var testingTarget = new NUIFrameComponent();
77             Assert.IsNotNull(testingTarget, "Should be not null.");
78             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
79
80             testingTarget.NUIWindowInfo = new NUIWindowInfo(Window.Instance);
81             tlog.Debug(tag, "testingTarget.NUIWindowInfo : " + testingTarget.NUIWindowInfo);
82             Assert.IsNotNull(testingTarget.NUIWindowInfo);
83
84             tlog.Debug(tag, $"NUIFrameComponentNUIWindowInfo END (OK)");
85         }
86
87         [Test]
88         [Category("P1")]
89         [Description("NUIFrameComponent Window")]
90         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.Window A")]
91         [Property("SPEC_URL", "-")]
92         [Property("CRITERIA", "PRW")]
93         [Property("AUTHOR", "guowei.wang@samsung.com")]
94         public void NUIFrameComponentWindow()
95         {
96             tlog.Debug(tag, $"NUIFrameComponentWindow START");
97
98             var testingTarget = new NUIFrameComponent();
99             Assert.IsNotNull(testingTarget, "Should be not null.");
100             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
101
102             testingTarget.Window = new Window(new Rectangle(0, 0, 1920, 1080), false);
103             tlog.Debug(tag, "testingTarget.Window : " + testingTarget.Window);
104             Assert.IsNotNull(testingTarget.Window);
105
106             tlog.Debug(tag, $"NUIFrameComponentWindow END (OK)");
107         }
108
109         [Test]
110         [Category("P1")]
111         [Description("NUIFrameComponent CreateWindowInfo")]
112         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.CreateWindowInfo M")]
113         [Property("SPEC_URL", "-")]
114         [Property("CRITERIA", "MR")]
115         [Property("AUTHOR", "guowei.wang@samsung.com")]
116         public void NUIFrameComponentCreateWindowInfo()
117         {
118             tlog.Debug(tag, $"NUIFrameComponentCreateWindowInfo START");
119
120             var testingTarget = new NUIFrameComponent();
121             Assert.IsNotNull(testingTarget, "Should be not null.");
122             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
123
124             try
125             {
126                 testingTarget.NUIWindowInfo = new NUIWindowInfo(Window.Instance);
127                 testingTarget.Window = new Window(new Rectangle(0, 0, 1920, 1080), false);
128                 
129                 testingTarget.CreateWindowInfo();
130             }
131             catch (Exception e)
132             {
133                 tlog.Debug(tag, e.Message.ToString());
134                 Assert.Fail("Caught Exception: Failed!");
135             }
136
137             tlog.Debug(tag, $"NUIFrameComponentCreateWindowInfo END (OK)");
138         }
139
140         [Test]
141         [Category("P1")]
142         [Description("NUIFrameComponent OnCreate.")]
143         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.OnCreate M")]
144         [Property("SPEC_URL", "-")]
145         [Property("CRITERIA", "MR")]
146         [Property("AUTHOR", "guowei.wang@samsung.com")]
147         public void NUIFrameComponentOnCreate()
148         {
149             tlog.Debug(tag, $"NUIFrameComponentOnCreate START");
150
151             var testingTarget = new MyNUIFrameComponent();
152             Assert.IsNotNull(testingTarget, "Should be not null.");
153             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
154
155             try
156             {
157                 testingTarget.MyOnCreate();
158             }
159             catch (Exception e)
160             {
161                 tlog.Debug(tag, e.Message.ToString());
162                 Assert.Fail("Caught Exception: Failed!");
163             }
164
165             tlog.Debug(tag, $"NUIFrameComponentOnCreate END (OK)");
166         }
167
168         [Test]
169         [Category("P1")]
170         [Description("NUIFrameComponent OnStart.")]
171         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.OnStart M")]
172         [Property("SPEC_URL", "-")]
173         [Property("CRITERIA", "MR")]
174         [Property("AUTHOR", "guowei.wang@samsung.com")]
175         public void NUIFrameComponentOnStart()
176         {
177             tlog.Debug(tag, $"NUIFrameComponentOnStart START");
178
179             var testingTarget = new MyNUIFrameComponent();
180             Assert.IsNotNull(testingTarget, "Should be not null.");
181             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
182
183             try
184             {
185                 Tizen.Applications.AppControl appControl = new Tizen.Applications.AppControl(true);
186                 testingTarget.MyOnStart(appControl, false);
187             }
188             catch (Exception e)
189             {
190                 tlog.Debug(tag, e.Message.ToString());
191                 Assert.Fail("Caught Exception: Failed!");
192             }
193
194             tlog.Debug(tag, $"NUIFrameComponentOnStart END (OK)");
195         }
196
197         [Test]
198         [Category("P1")]
199         [Description("NUIFrameComponent OnResume.")]
200         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.OnResume M")]
201         [Property("SPEC_URL", "-")]
202         [Property("CRITERIA", "MR")]
203         [Property("AUTHOR", "guowei.wang@samsung.com")]
204         public void NUIFrameComponentOnResume()
205         {
206             tlog.Debug(tag, $"NUIFrameComponentOnResume START");
207
208             var testingTarget = new MyNUIFrameComponent();
209             Assert.IsNotNull(testingTarget, "Should be not null.");
210             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
211
212             try
213             {
214                 testingTarget.MyOnResume();
215             }
216             catch (Exception e)
217             {
218                 tlog.Debug(tag, e.Message.ToString());
219                 Assert.Fail("Caught Exception: Failed!");
220             }
221
222             tlog.Debug(tag, $"NUIFrameComponentOnResume END (OK)");
223         }
224
225         [Test]
226         [Category("P1")]
227         [Description("NUIFrameComponent OnPause.")]
228         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.OnPause M")]
229         [Property("SPEC_URL", "-")]
230         [Property("CRITERIA", "MR")]
231         [Property("AUTHOR", "guowei.wang@samsung.com")]
232         public void NUIFrameComponentOnPause()
233         {
234             tlog.Debug(tag, $"NUIFrameComponentOnPause START");
235
236             var testingTarget = new MyNUIFrameComponent();
237             Assert.IsNotNull(testingTarget, "Should be not null.");
238             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
239
240             try
241             {
242                 testingTarget.MyOnPause();
243             }
244             catch (Exception e)
245             {
246                 tlog.Debug(tag, e.Message.ToString());
247                 Assert.Fail("Caught Exception: Failed!");
248             }
249
250             tlog.Debug(tag, $"NUIFrameComponentOnPause END (OK)");
251         }
252
253         [Test]
254         [Category("P1")]
255         [Description("NUIFrameComponent OnStop.")]
256         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.OnStop M")]
257         [Property("SPEC_URL", "-")]
258         [Property("CRITERIA", "MR")]
259         [Property("AUTHOR", "guowei.wang@samsung.com")]
260         public void NUIFrameComponentOnStop()
261         {
262             tlog.Debug(tag, $"NUIFrameComponentOnStop START");
263
264             var testingTarget = new MyNUIFrameComponent();
265             Assert.IsNotNull(testingTarget, "Should be not null.");
266             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
267
268             try
269             {
270                 testingTarget.MyOnStop();
271             }
272             catch (Exception e)
273             {
274                 tlog.Debug(tag, e.Message.ToString());
275                 Assert.Fail("Caught Exception: Failed!");
276             }
277
278             tlog.Debug(tag, $"NUIFrameComponentOnStop END (OK)");
279         }
280
281         [Test]
282         [Category("P1")]
283         [Description("NUIFrameComponent OnDestroy.")]
284         [Property("SPEC", "Tizen.NUI.NUIFrameComponent.OnDestroy M")]
285         [Property("SPEC_URL", "-")]
286         [Property("CRITERIA", "MR")]
287         [Property("AUTHOR", "guowei.wang@samsung.com")]
288         public void NUIFrameComponentOnDestroy()
289         {
290             tlog.Debug(tag, $"NUIFrameComponentOnDestroy START");
291
292             var testingTarget = new MyNUIFrameComponent();
293             Assert.IsNotNull(testingTarget, "Should be not null.");
294             Assert.IsInstanceOf<NUIFrameComponent>(testingTarget, "Should be an instance of NUIFrameComponent type.");
295
296             try
297             {
298                 testingTarget.MyOnDestroy();
299             }
300             catch (Exception e)
301             {
302                 tlog.Debug(tag, e.Message.ToString());
303                 Assert.Fail("Caught Exception: Failed!");
304             }
305
306             tlog.Debug(tag, $"NUIFrameComponentOnDestroy END (OK)");
307         }
308     }
309 }