1 using NUnit.Framework;
3 using System.Collections.Generic;
5 using System.Threading.Tasks;
6 using Tizen.NUI.BaseComponents;
8 namespace Tizen.NUI.Components.Devel.Tests
10 using tlog = Tizen.Log;
12 class TestDefaultLinearItem : DefaultLinearItem
14 public void LayoutTest()
21 [Description("Controls/RecyclerView/Item/DefaultLinearItem")]
22 class TSDefaultLinearItem
24 private const string tag = "NUITEST";
29 tlog.Info(tag, "Init() is called!");
35 tlog.Info(tag, "Destroy() is called!");
40 [Description("DefaultLinearItem constructor.")]
41 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem C")]
42 [Property("SPEC_URL", "-")]
43 [Property("CRITERIA", "CONSTR")]
44 [Property("COVPARAM", "")]
45 [Property("AUTHOR", "huayong.xu@samsung.com")]
46 public void DefaultLinearItemConstructor()
48 tlog.Debug(tag, $"DefaultGridItem START");
50 var testingTarget = new DefaultLinearItem();
52 Assert.IsNotNull(testingTarget, "should be not null");
53 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
55 testingTarget.Dispose();
56 tlog.Debug(tag, $"DefaultGridItem END (OK)");
61 [Description("DefaultLinearItem constructor.")]
62 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem C")]
63 [Property("SPEC_URL", "-")]
64 [Property("CRITERIA", "CONSTR")]
65 [Property("COVPARAM", "")]
66 [Property("AUTHOR", "huayong.xu@samsung.com")]
67 public void DefaultLinearItemConstructorWithStyle()
69 tlog.Debug(tag, $"DefaultLinearItem START");
71 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
73 Assert.IsNotNull(testingTarget, "should be not null");
74 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
76 testingTarget.Dispose();
77 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
82 [Description("DefaultLinearItem constructor.")]
83 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem C")]
84 [Property("SPEC_URL", "-")]
85 [Property("CRITERIA", "CONSTR")]
86 [Property("COVPARAM", "")]
87 [Property("AUTHOR", "huayong.xu@samsung.com")]
88 public void DefaultLinearItemConstructorWithItemStyle()
90 tlog.Debug(tag, $"DefaultLinearItem START");
92 var style = new DefaultLinearItemStyle()
95 Padding = new Extents(64, 64, 18, 17),
96 Margin = new Extents(0, 0, 0, 0),
97 Icon = new ViewStyle()
99 Margin = new Extents(0, 32, 0, 0)
102 var testingTarget = new DefaultLinearItem(style);
104 Assert.IsNotNull(testingTarget, "should be not null");
105 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
107 testingTarget.Dispose();
108 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
113 [Description("DefaultLinearItem Icon.")]
114 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.Icon A")]
115 [Property("SPEC_URL", "-")]
116 [Property("CRITERIA", "PRW")]
117 [Property("COVPARAM", "")]
118 [Property("AUTHOR", "huayong.xu@samsung.com")]
119 public void DefaultLinearItemIcon()
121 tlog.Debug(tag, $"DefaultLinearItem START");
123 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
125 Assert.IsNotNull(testingTarget, "should be not null");
126 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
128 testingTarget.Icon = new View()
130 Size = new Size(100, 100),
132 Assert.IsNotNull(testingTarget.Icon, "should be not null");
134 testingTarget.Dispose();
135 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
140 [Description("DefaultLinearItem Label.")]
141 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.Label A")]
142 [Property("SPEC_URL", "-")]
143 [Property("CRITERIA", "PRW")]
144 [Property("COVPARAM", "")]
145 [Property("AUTHOR", "huayong.xu@samsung.com")]
146 public void DefaultLinearItemLabel()
148 tlog.Debug(tag, $"DefaultLinearItem START");
150 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
152 Assert.IsNotNull(testingTarget, "should be not null");
153 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
155 testingTarget.Label = new TextLabel()
159 Assert.IsNotNull(testingTarget.Label, "should be not null");
161 testingTarget.Dispose();
162 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
167 [Description("DefaultLinearItem Text.")]
168 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.Text A")]
169 [Property("SPEC_URL", "-")]
170 [Property("CRITERIA", "PRW")]
171 [Property("COVPARAM", "")]
172 [Property("AUTHOR", "huayong.xu@samsung.com")]
173 public void DefaultLinearItemText()
175 tlog.Debug(tag, $"DefaultLinearItem START");
177 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
179 Assert.IsNotNull(testingTarget, "should be not null");
180 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
182 testingTarget.Text = "test";
183 Assert.AreEqual(testingTarget.Text, "test", "should be equal.");
185 testingTarget.Dispose();
186 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
191 [Description("DefaultLinearItem SubLabel.")]
192 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.SubLabel A")]
193 [Property("SPEC_URL", "-")]
194 [Property("CRITERIA", "PRW")]
195 [Property("COVPARAM", "")]
196 [Property("AUTHOR", "huayong.xu@samsung.com")]
197 public void DefaultLinearItemSubLabel()
199 tlog.Debug(tag, $"DefaultLinearItem START");
201 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
203 Assert.IsNotNull(testingTarget, "should be not null");
204 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
206 testingTarget.SubLabel = new TextLabel()
210 Assert.IsNotNull(testingTarget.SubLabel, "should be not null");
212 testingTarget.Dispose();
213 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
218 [Description("DefaultLinearItem SubText.")]
219 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.SubText A")]
220 [Property("SPEC_URL", "-")]
221 [Property("CRITERIA", "PRW")]
222 [Property("COVPARAM", "")]
223 [Property("AUTHOR", "huayong.xu@samsung.com")]
224 public void DefaultLinearSubText()
226 tlog.Debug(tag, $"DefaultLinearItem START");
228 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
230 Assert.IsNotNull(testingTarget, "should be not null");
231 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
233 testingTarget.SubText = "test";
234 Assert.AreEqual(testingTarget.SubText, "test", "should be equal.");
236 testingTarget.Dispose();
237 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
242 [Description("DefaultLinearItem Extra.")]
243 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.Extra A")]
244 [Property("SPEC_URL", "-")]
245 [Property("CRITERIA", "PRW")]
246 [Property("COVPARAM", "")]
247 [Property("AUTHOR", "huayong.xu@samsung.com")]
248 public void DefaultLinearItemExtra()
250 tlog.Debug(tag, $"DefaultLinearItem START");
252 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
254 Assert.IsNotNull(testingTarget, "should be not null");
255 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
257 testingTarget.Extra = new View()
259 Size = new Size(100, 100),
261 Assert.IsNotNull(testingTarget.Extra, "should be not null");
263 testingTarget.Dispose();
264 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
267 //Todo: this causes BLOCK, should be fixed.
270 [Description("DefaultLinearItem Extra.")]
271 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.Extra A")]
272 [Property("SPEC_URL", "-")]
273 [Property("CRITERIA", "PRW")]
274 [Property("COVPARAM", "")]
275 [Property("AUTHOR", "huayong.xu@samsung.com")]
276 public async Task DefaultLinearItemExtraNull()
278 tlog.Debug(tag, $"DefaultLinearItem START");
280 TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
281 EventHandler onAddedToWindow = (s, e) => { tcs.TrySetResult(true); };
283 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
285 Assert.IsNotNull(testingTarget, "should be not null");
286 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
288 testingTarget.SubLabel = new TextLabel()
292 Assert.IsNotNull(testingTarget.SubLabel, "should be not null");
294 Assert.IsNotNull(testingTarget.Extra, "should be not null");
295 testingTarget.Extra.Size = new Size(100, 100);
296 testingTarget.Extra.AddedToWindow += onAddedToWindow;
298 Window.Instance.Add(testingTarget.Extra);
300 var result = await tcs.Task;
301 Assert.IsTrue(result, "Relayout event should be invoked");
303 testingTarget.Dispose();
304 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
309 [Description("DefaultLinearItem Seperator.")]
310 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.Seperator A")]
311 [Property("SPEC_URL", "-")]
312 [Property("CRITERIA", "PRO")]
313 [Property("COVPARAM", "")]
314 [Property("AUTHOR", "huayong.xu@samsung.com")]
315 public void DefaultLinearItemSeperator()
317 tlog.Debug(tag, $"DefaultLinearItem START");
319 var testingTarget = new DefaultLinearItem("Tizen.NUI.Components.DefaultLinearItem");
321 Assert.IsNotNull(testingTarget, "should be not null");
322 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
324 Assert.IsNotNull(testingTarget.Seperator, "should not be null");
326 testingTarget.Dispose();
327 tlog.Debug(tag, $"DefaultLinearItem END (OK)");
332 [Description("DefaultLinearItem LayoutChild.")]
333 [Property("SPEC", "Tizen.NUI.Components.DefaultLinearItem.LayoutChild M")]
334 [Property("SPEC_URL", "-")]
335 [Property("CRITERIA", "MR")]
336 [Property("COVPARAM", "")]
337 [Property("AUTHOR", "huayong.xu@samsung.com")]
338 public void DefaultLinearItemLayoutChild()
340 tlog.Debug(tag, $"DefaultGridItem START");
342 var testingTarget = new TestDefaultLinearItem();
344 Assert.IsNotNull(testingTarget, "should be not null");
345 Assert.IsInstanceOf<DefaultLinearItem>(testingTarget, "should be an instance of testing target class!");
347 testingTarget.Extra = new View()
349 Size = new Size(100, 100),
351 Assert.IsNotNull(testingTarget.Extra, "should be not null");
352 testingTarget.Icon = new View()
354 Size = new Size(100, 100),
356 Assert.IsNotNull(testingTarget.Icon, "should be not null");
357 testingTarget.Label = new TextLabel()
359 WidthSpecification = 170,
360 HeightSpecification = 170,
362 Assert.IsNotNull(testingTarget.Label, "DefaultLinearItem Label should not be null.");
363 testingTarget.SubLabel = new TextLabel()
367 Assert.IsNotNull(testingTarget.SubLabel, "should be not null");
368 testingTarget.LayoutTest();
370 testingTarget.Dispose();
371 tlog.Debug(tag, $"DefaultGridItem END (OK)");