3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("internal/Common/ViewImpl")]
13 public class InternalViewImplTest
15 private const string tag = "NUITEST";
20 tlog.Info(tag, "Init() is called!");
26 tlog.Info(tag, "Destroy() is called!");
31 [Description("ViewImpl New.")]
32 [Property("SPEC", "Tizen.NUI.ViewImpl.New M")]
33 [Property("SPEC_URL", "-")]
34 [Property("CRITERIA", "MR")]
35 [Property("COVPARAM", "")]
36 [Property("AUTHOR", "guowei.wang@samsung.com")]
37 public void ViewImplNew()
39 tlog.Debug(tag, $"ViewImplNew START");
41 var testingTarget = ViewImpl.New();
42 Assert.IsNotNull(testingTarget, "null handle");
43 Assert.IsInstanceOf<View>(testingTarget, "Should return View instance.");
45 testingTarget.Dispose();
46 tlog.Debug(tag, $"ViewImplNew END (OK)");
51 [Description("ViewImpl getCPtr.")]
52 [Property("SPEC", "Tizen.NUI.ViewImpl.getCPtr M")]
53 [Property("SPEC_URL", "-")]
54 [Property("CRITERIA", "MR")]
55 [Property("COVPARAM", "")]
56 [Property("AUTHOR", "guowei.wang@samsung.com")]
57 public void ViewImplGetCPtr()
59 tlog.Debug(tag, $"ViewImplGetCPtr START");
61 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
63 var testingTarget = new ViewWrapper("CustomView", impl);
64 Assert.IsNotNull(testingTarget, "should be not null");
65 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
67 var result = ViewWrapperImpl.getCPtr(testingTarget.viewWrapperImpl);
68 tlog.Debug(tag, "getCptr : " + result);
70 testingTarget.Dispose();
73 tlog.Debug(tag, $"ViewImplGetCPtr END (OK)");
78 [Description("ViewImpl SetStyleName.")]
79 [Property("SPEC", "Tizen.NUI.ViewImpl.SetStyleName M")]
80 [Property("SPEC_URL", "-")]
81 [Property("CRITERIA", "MR")]
82 [Property("COVPARAM", "")]
83 [Property("AUTHOR", "guowei.wang@samsung.com")]
84 public void ViewImplSetStyleName()
86 tlog.Debug(tag, $"ViewImplSetStyleName START");
88 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
90 var testingTarget = new ViewWrapper("CustomView", impl);
91 Assert.IsNotNull(testingTarget, "should be not null");
92 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
94 testingTarget.viewWrapperImpl.SetStyleName("style");
95 var result = testingTarget.viewWrapperImpl.GetStyleName();
96 tlog.Debug(tag, "StyleName : " + result);
98 testingTarget.Dispose();
101 tlog.Debug(tag, $"ViewImplSetStyleName END (OK)");
106 [Description("ViewImpl SetBackgroundColor.")]
107 [Property("SPEC", "Tizen.NUI.ViewImpl.SetBackgroundColor M")]
108 [Property("SPEC_URL", "-")]
109 [Property("CRITERIA", "MR")]
110 [Property("COVPARAM", "")]
111 [Property("AUTHOR", "guowei.wang@samsung.com")]
112 public void ViewImplSetBackgroundColor()
114 tlog.Debug(tag, $"ViewImplSetBackgroundColor START");
116 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
118 var testingTarget = new ViewWrapper("CustomView", impl);
119 Assert.IsNotNull(testingTarget, "should be not null");
120 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
122 using (Vector4 color = new Vector4(0.3f, 0.5f, 0.9f, 1.0f))
124 testingTarget.viewWrapperImpl.SetBackgroundColor(color);
125 //tlog.Debug(tag, "BackgroundColor : " + wrapper.viewWrapperImpl.GetBackgroundColor());
128 testingTarget.Dispose();
131 tlog.Debug(tag, $"ViewImplSetBackgroundColor END (OK)");
136 [Description("ViewImpl SetBackground.")]
137 [Property("SPEC", "Tizen.NUI.ViewImpl.SetBackground M")]
138 [Property("SPEC_URL", "-")]
139 [Property("CRITERIA", "MR")]
140 [Property("COVPARAM", "")]
141 [Property("AUTHOR", "guowei.wang@samsung.com")]
142 public void ViewImplSetBackground()
144 tlog.Debug(tag, $"ViewImplSetBackground START");
146 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
148 var testingTarget = new ViewWrapper("CustomView", impl);
149 Assert.IsNotNull(testingTarget, "should be not null");
150 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
152 using (ColorVisual colorVisual = new ColorVisual())
154 colorVisual.Color = Color.Cyan;
158 testingTarget.viewWrapperImpl.SetBackground(colorVisual.OutputVisualMap);
162 tlog.Debug(tag, e.Message.ToString());
163 Assert.Fail("Caught Exception : Failed!");
167 testingTarget.viewWrapperImpl.ClearBackground();
169 testingTarget.Dispose();
172 tlog.Debug(tag, $"ViewImplSetBackground END (OK)");
177 [Description("ViewImpl EnableGestureDetection.")]
178 [Property("SPEC", "Tizen.NUI.ViewImpl.EnableGestureDetection M")]
179 [Property("SPEC_URL", "-")]
180 [Property("CRITERIA", "MR")]
181 [Property("COVPARAM", "")]
182 [Property("AUTHOR", "guowei.wang@samsung.com")]
183 public void ViewImplEnableGestureDetection()
185 tlog.Debug(tag, $"ViewImplEnableGestureDetection START");
187 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
189 var testingTarget = new ViewWrapper("CustomView", impl);
190 Assert.IsNotNull(testingTarget, "should be not null");
191 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
195 testingTarget.viewWrapperImpl.EnableGestureDetection(Gesture.GestureType.LongPress);
196 testingTarget.viewWrapperImpl.DisableGestureDetection(Gesture.GestureType.LongPress);
200 tlog.Debug(tag, e.Message.ToString());
201 Assert.Fail("Caught Exception : Failed!");
204 testingTarget.Dispose();
207 tlog.Debug(tag, $"ViewImplEnableGestureDetection (OK)");
212 [Description("ViewImpl GetPinchGestureDetector.")]
213 [Property("SPEC", "Tizen.NUI.ViewImpl.GetPinchGestureDetector M")]
214 [Property("SPEC_URL", "-")]
215 [Property("CRITERIA", "MR")]
216 [Property("COVPARAM", "")]
217 [Property("AUTHOR", "guowei.wang@samsung.com")]
218 public void ViewImplGetGestureDetector()
220 tlog.Debug(tag, $"ViewImplGetGestureDetector START");
222 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
224 var testingTarget = new ViewWrapper("CustomView", impl);
225 Assert.IsNotNull(testingTarget, "should be not null");
226 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
228 var pinchGesture = testingTarget.viewWrapperImpl.GetPinchGestureDetector();
229 Assert.IsInstanceOf<PinchGestureDetector>(pinchGesture, "should be an instance of testing target class!");
231 var panGesture = testingTarget.viewWrapperImpl.GetPanGestureDetector();
232 Assert.IsInstanceOf<PanGestureDetector>(panGesture, "should be an instance of testing target class!");
234 var tapGesture = testingTarget.viewWrapperImpl.GetTapGestureDetector();
235 Assert.IsInstanceOf<TapGestureDetector>(tapGesture, "should be an instance of testing target class!");
237 var pressGesture = testingTarget.viewWrapperImpl.GetLongPressGestureDetector();
238 Assert.IsInstanceOf<LongPressGestureDetector>(pressGesture, "should be an instance of testing target class!");
240 testingTarget.Dispose();
243 tlog.Debug(tag, $"ViewImplGetGestureDetector (OK)");
248 [Description("ViewImpl SetKeyInputFocus.")]
249 [Property("SPEC", "Tizen.NUI.ViewImpl.SetKeyInputFocus M")]
250 [Property("SPEC_URL", "-")]
251 [Property("CRITERIA", "MR")]
252 [Property("COVPARAM", "")]
253 [Property("AUTHOR", "guowei.wang@samsung.com")]
254 public void ViewImplSetKeyInputFocus()
256 tlog.Debug(tag, $"ViewImplSetKeyInputFocus START");
258 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
260 var testingTarget = new ViewWrapper("CustomView", impl);
261 Assert.IsNotNull(testingTarget, "should be not null");
262 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
264 testingTarget.viewWrapperImpl.SetKeyInputFocus();
265 var result = testingTarget.viewWrapperImpl.HasKeyInputFocus();
266 tlog.Debug(tag, "HasKeyInputFocus : " + result);
267 testingTarget.viewWrapperImpl.ClearKeyInputFocus();
269 testingTarget.Dispose();
272 tlog.Debug(tag, $"ViewImplSetKeyInputFocus (OK)");
277 [Description("ViewImpl KeyEventSignal.")]
278 [Property("SPEC", "Tizen.NUI.ViewImpl.KeyEventSignal M")]
279 [Property("SPEC_URL", "-")]
280 [Property("CRITERIA", "MR")]
281 [Property("COVPARAM", "")]
282 [Property("AUTHOR", "guowei.wang@samsung.com")]
283 public void ViewImplSignal()
285 tlog.Debug(tag, $"ViewImplSignal START");
287 using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
289 var testingTarget = new ViewWrapper("CustomView", impl);
290 Assert.IsNotNull(testingTarget, "should be not null");
291 Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
293 var signal = testingTarget.viewWrapperImpl.KeyEventSignal();
294 Assert.IsInstanceOf<ControlKeySignal>(signal, "Should return ControlKeySignal instance.");
296 var focusGained = testingTarget.viewWrapperImpl.KeyInputFocusGainedSignal();
297 Assert.IsInstanceOf<KeyInputFocusSignal>(focusGained, "Should return ControlKeySignal instance.");
299 var focusLost = testingTarget.viewWrapperImpl.KeyInputFocusLostSignal();
300 Assert.IsInstanceOf<KeyInputFocusSignal>(focusLost, "Should return ControlKeySignal instance.");
302 testingTarget.Dispose();
305 tlog.Debug(tag, $"ViewImplSignal (OK)");
310 //[Description("ViewImpl EmitKeyEventSignal.")]
311 //[Property("SPEC", "Tizen.NUI.ViewImpl.EmitKeyEventSignal M")]
312 //[Property("SPEC_URL", "-")]
313 //[Property("CRITERIA", "MR")]
314 //[Property("COVPARAM", "")]
315 //[Property("AUTHOR", "guowei.wang@samsung.com")]
316 //public void ViewImplEmitKeyEventSignal()
318 // tlog.Debug(tag, $"ViewImplEmitKeyEventSignal START");
320 // using (ViewWrapperImpl impl = new ViewWrapperImpl(CustomViewBehaviour.ViewBehaviourDefault))
322 // var testingTarget = new ViewWrapper("CustomView", impl);
323 // Assert.IsNotNull(testingTarget, "should be not null");
324 // Assert.IsInstanceOf<ViewWrapper>(testingTarget, "should be an instance of testing target class!");
326 // using (Key key = new Key())
328 // var result = testingTarget.viewWrapperImpl.EmitKeyEventSignal(key);
329 // tlog.Debug(tag, "EmitKeyEventSignal : " + result);
332 // testingTarget.Dispose();
335 // tlog.Debug(tag, $"ViewImplEmitKeyEventSignal (OK)");