2 using System.Collections.Generic;
5 namespace Tizen.NUI.Components.Devel.Tests
7 using tlog = Tizen.Log;
10 [Description("Controls/FlexibleView/FlexibleViewAdapter")]
11 public class FlexibleViewAdapterTest
13 private const string tag = "NUITEST";
15 private Vector2 scrnSize;
16 private ListBridge adapter;
17 private FlexibleView horizontalFlexibleView;
18 private LinearLayoutManager horizontalLayoutManager;
25 tlog.Info(tag, "Destroy() is called!");
28 private FlexibleView GetHorizontalFlexibleView()
30 horizontalFlexibleView = new FlexibleView();
31 Assert.IsNotNull(horizontalFlexibleView, "should be not null");
32 Assert.IsInstanceOf<FlexibleView>(horizontalFlexibleView, "should be an instance of testing target class!");
34 horizontalFlexibleView.Name = "FlexibleView";
35 horizontalFlexibleView.WidthSpecification = 400;
36 horizontalFlexibleView.HeightSpecification = 450;
37 horizontalFlexibleView.Padding = new Extents(10, 10, 10, 10);
38 horizontalFlexibleView.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.4f);
40 List<ListItemData> dataList = new List<ListItemData>();
41 for (int i = 0; i < 4; ++i)
43 dataList.Add(new ListItemData(i));
45 adapter = new ListBridge(dataList);
46 horizontalFlexibleView.SetAdapter(adapter);
47 horizontalFlexibleView.OnRelayout(scrnSize, null);
49 horizontalLayoutManager = new LinearLayoutManager(LinearLayoutManager.HORIZONTAL);
50 horizontalFlexibleView.SetLayoutManager(horizontalLayoutManager);
51 horizontalFlexibleView.OnRelayout(scrnSize, null);
53 return horizontalFlexibleView;
58 [Description("FlexibleViewAdapter NotifyItemChanged.")]
59 [Property("SPEC", "Tizen.NUI.Components.FlexibleView.FlexibleViewAdapter.NotifyItemChanged M")]
60 [Property("SPEC_URL", "-")]
61 [Property("CRITERIA", "MR")]
62 [Property("COVPARAM", "")]
63 [Property("AUTHOR", "guowei.wang@samsung.com")]
64 public void FlexibleViewAdapterNotifyItemChanged()
66 tlog.Debug(tag, $"FlexibleViewAdapterNotifyItemChanged START");
68 var testingTarget = GetHorizontalFlexibleView();
69 Assert.IsNotNull(testingTarget, "should be not null");
70 Assert.IsInstanceOf<FlexibleView>(testingTarget, "should be an instance of testing target class!");
74 testingTarget.GetAdapter().NotifyItemChanged(2);
78 tlog.Debug(tag, e.Message.ToString());
79 Assert.Fail("Caught Exception : Failed!");
82 testingTarget.Dispose();
83 tlog.Debug(tag, $"FlexibleViewAdapterNotifyItemChanged END (OK)");
88 [Description("FlexibleViewAdapter NotifyItemRangeChanged.")]
89 [Property("SPEC", "Tizen.NUI.Components.FlexibleView.FlexibleViewAdapter.NotifyItemRangeChanged M")]
90 [Property("SPEC_URL", "-")]
91 [Property("CRITERIA", "MR")]
92 [Property("COVPARAM", "")]
93 [Property("AUTHOR", "guowei.wang@samsung.com")]
94 public void FlexibleViewAdapterNotifyItemRangeChanged()
96 tlog.Debug(tag, $"FlexibleViewAdapterNotifyItemRangeChanged START");
98 var testingTarget = GetHorizontalFlexibleView();
99 Assert.IsNotNull(testingTarget, "should be not null");
100 Assert.IsInstanceOf<FlexibleView>(testingTarget, "should be an instance of testing target class!");
104 testingTarget.GetAdapter().NotifyItemRangeChanged(2, 2);
108 tlog.Debug(tag, e.Message.ToString());
109 Assert.Fail("Caught Exception : Failed!");
112 testingTarget.Dispose();
113 tlog.Debug(tag, $"FlexibleViewAdapterNotifyItemRangeChanged END (OK)");