[NUI] Add TCs for NUI.Components.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Components.Devel.Tests / testcase / Controls / TSImageScrollBar.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI;
5 using Tizen.NUI.Components;
6 using Tizen.NUI.BaseComponents;
7
8 namespace Tizen.NUI.Components.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("Controls/ImageScrollBar")]
14     public class ImageScrollBarTest
15     {
16         private const string tag = "NUITEST";
17         private string path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
18
19         [Obsolete]
20         internal class MyScrollBar : ScrollBar
21         {
22             public MyScrollBar() : base()
23             { }
24
25             public void OnCreateViewStyle()
26             {
27                 base.CreateViewStyle();
28             }
29         }
30
31         [SetUp]
32         public void Init()
33         {
34             tlog.Info(tag, "Init() is called!");
35         }
36
37         [TearDown]
38         public void Destroy()
39         {
40             tlog.Info(tag, "Destroy() is called!");
41         }
42
43         [Test]
44         [Category("P1")]
45         [Description("ScrollBar constructor.")]
46         [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ScrollBar C")]
47         [Property("SPEC_URL", "-")]
48         [Property("CRITERIA", "CONSTR")]
49         [Property("COVPARAM", "")]
50         [Property("AUTHOR", "guowei.wang@samsung.com")]
51         [Obsolete]
52         public void ScrollBarConstructor()
53         {
54             tlog.Debug(tag, $"ScrollBarConstructor START");
55
56             var testingTarget = new ScrollBar();
57             Assert.IsNotNull(testingTarget, "null handle");
58             Assert.IsInstanceOf<ScrollBar>(testingTarget, "Should return ScrollBar instance.");
59
60             testingTarget.MinValue = 0;
61             tlog.Debug(tag, "MinValue : " + testingTarget.MinValue);
62             
63             testingTarget.MaxValue = 100;
64             tlog.Debug(tag, "MaxValue : " + testingTarget.MaxValue);
65
66             testingTarget.Duration = 3;
67             tlog.Debug(tag, "Duration : " + testingTarget.Duration);
68
69             testingTarget.CurrentValue = 30;
70             tlog.Debug(tag, "CurrentValue : " + testingTarget.CurrentValue);
71
72             try
73             {
74                 testingTarget.SetCurrentValue(50, true);
75                 tlog.Debug(tag, "CurrentValue : " + testingTarget.CurrentValue);
76             }
77             catch (Exception e)
78             {
79                 tlog.Debug(tag, e.Message.ToString());
80                 Assert.Fail("Caught Exception : Failed!");
81             }
82
83             testingTarget.Dispose();
84             tlog.Debug(tag, $"ScrollBarConstructor END (OK)");
85         }
86
87         [Test]
88         [Category("P1")]
89         [Description("ScrollBar constructor.")]
90         [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ScrollBar C")]
91         [Property("SPEC_URL", "-")]
92         [Property("CRITERIA", "CONSTR")]
93         [Property("COVPARAM", "")]
94         [Property("AUTHOR", "guowei.wang@samsung.com")]
95         [Obsolete]
96         public void ScrollBarConstructorWithScrollBarStyle()
97         {
98             tlog.Debug(tag, $"ScrollBarConstructorWithScrollBarStyle START");
99
100             ScrollBarStyle style = new ScrollBarStyle()
101             { 
102                 Size = new Size(30, 2),
103                 HeightResizePolicy = ResizePolicyType.Fixed,
104             };
105
106             var testingTarget = new ScrollBar(style);
107             Assert.IsNotNull(testingTarget, "null handle");
108             Assert.IsInstanceOf<ScrollBar>(testingTarget, "Should return ScrollBar instance.");
109
110             testingTarget.Dispose();
111             tlog.Debug(tag, $"ScrollBarConstructorWithScrollBarStyle END (OK)");
112         }
113
114         [Test]
115         [Category("P1")]
116         [Description("ScrollBar Direction.")]
117         [Property("SPEC", "Tizen.NUI.Components.ScrollBar.Direction A")]
118         [Property("SPEC_URL", "-")]
119         [Property("CRITERIA", "PRW")]
120         [Property("COVPARAM", "")]
121         [Property("AUTHOR", "guowei.wang@samsung.com")]
122         [Obsolete]
123         public void ScrollBarDirection()
124         {
125             tlog.Debug(tag, $"ScrollBarDirection START");
126
127             var testingTarget = new ScrollBar()
128             {
129                 Direction = ScrollBar.DirectionType.Vertical,
130             };
131             Assert.IsNotNull(testingTarget, "null handle");
132             Assert.IsInstanceOf<ScrollBar>(testingTarget, "Should return ScrollBar instance.");
133
134             tlog.Debug(tag, "Direction : " + testingTarget.Direction);
135
136             testingTarget.Direction = ScrollBar.DirectionType.Horizontal;
137             tlog.Debug(tag, "Direction : " + testingTarget.Direction);
138
139             testingTarget.Dispose();
140             tlog.Debug(tag, $"ScrollBarDirection END (OK)");
141         }
142
143         [Test]
144         [Category("P1")]
145         [Description("ScrollBar ThumbSize.")]
146         [Property("SPEC", "Tizen.NUI.Components.ScrollBar.ThumbSize A")]
147         [Property("SPEC_URL", "-")]
148         [Property("CRITERIA", "PRW")]
149         [Property("COVPARAM", "")]
150         [Property("AUTHOR", "guowei.wang@samsung.com")]
151         [Obsolete]
152         public void ScrollBarThumbSize()
153         {
154             tlog.Debug(tag, $"ScrollBarThumbSize START");
155
156             var testingTarget = new ScrollBar()
157             {
158                 Direction = ScrollBar.DirectionType.Vertical,
159                 ThumbSize = new Size(10, 5)
160             };
161             Assert.IsNotNull(testingTarget, "null handle");
162             Assert.IsInstanceOf<ScrollBar>(testingTarget, "Should return ScrollBar instance.");
163
164             tlog.Debug(tag, "ThumbSize : " + testingTarget.ThumbSize);
165
166             testingTarget.ThumbSize = new Size(8, 4);
167             tlog.Debug(tag, "ThumbSize : " + testingTarget.ThumbSize);
168
169             testingTarget.ThumbColor = Color.Yellow;
170             tlog.Debug(tag, "ThumbColor : " + testingTarget.ThumbColor);
171
172             testingTarget.Dispose();
173             tlog.Debug(tag, $"ScrollBarThumbSize END (OK)");
174         }
175
176         [Test]
177         [Category("P1")]
178         [Description("ScrollBar TrackImageURL.")]
179         [Property("SPEC", "Tizen.NUI.Components.ScrollBar.TrackImageURL A")]
180         [Property("SPEC_URL", "-")]
181         [Property("CRITERIA", "PRW")]
182         [Property("COVPARAM", "")]
183         [Property("AUTHOR", "guowei.wang@samsung.com")]
184         [Obsolete]
185         public void ScrollBarTrackImageURL()
186         {
187             tlog.Debug(tag, $"ScrollBarTrackImageURL START");
188
189             var testingTarget = new ScrollBar()
190             {
191                 Direction = ScrollBar.DirectionType.Vertical,
192                 ThumbSize = new Size(10, 5)
193             };
194             Assert.IsNotNull(testingTarget, "null handle");
195             Assert.IsInstanceOf<ScrollBar>(testingTarget, "Should return ScrollBar instance.");
196
197             testingTarget.TrackImageURL = path;
198             tlog.Debug(tag, "TrackImageURL : " + testingTarget.TrackImageURL);
199
200             testingTarget.TrackColor = Color.Black;
201             tlog.Debug(tag, "TrackColor : " + testingTarget.TrackColor);
202
203             testingTarget.Dispose();
204             tlog.Debug(tag, $"ScrollBarTrackImageURL END (OK)");
205         }
206
207         [Test]
208         [Category("P1")]
209         [Description("ScrollBar CreateViewStyle.")]
210         [Property("SPEC", "Tizen.NUI.Components.ScrollBar.CreateViewStyle M")]
211         [Property("SPEC_URL", "-")]
212         [Property("CRITERIA", "MR")]
213         [Property("COVPARAM", "")]
214         [Property("AUTHOR", "guowei.wang@samsung.com")]
215         [Obsolete]
216         public void ScrollBarCreateViewStyle()
217         {
218             tlog.Debug(tag, $"ScrollBarCreateViewStyle START");
219
220             var testingTarget = new MyScrollBar();
221             Assert.IsNotNull(testingTarget, "null handle");
222             Assert.IsInstanceOf<ScrollBar>(testingTarget, "Should return ScrollBar instance.");
223
224             try
225             {
226                 testingTarget.OnCreateViewStyle();
227             }
228             catch (Exception e)
229             {
230                 tlog.Debug(tag, e.Message.ToString());
231                 Assert.Fail("Caught Exception : Failed!");
232             }
233
234             testingTarget.Dispose();
235             tlog.Debug(tag, $"ScrollBarCreateViewStyle END (OK)");
236         }
237     }
238 }