3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Reflection;
7 using System.Collections.Generic;
8 using Tizen.NUI.Binding;
10 namespace Tizen.NUI.Devel.Tests
12 using tlog = Tizen.Log;
15 [Description("internal/XamlBinding/VectorTypeConverter")]
16 public class InternalVectorTypeConverterTest
18 private const string tag = "NUITEST";
19 private string selfpath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Test_Theme.xaml";
21 internal class Vector2TypeConverterImpl : Vector2TypeConverter
23 public Vector2TypeConverterImpl()
27 internal class Vector3TypeConverterImpl : Vector3TypeConverter
29 public Vector3TypeConverterImpl()
34 internal class Vector4TypeConverterImpl : Vector4TypeConverter
36 public Vector4TypeConverterImpl()
40 internal class RelativeVector2TypeConverterImpl : RelativeVector2TypeConverter
42 public RelativeVector2TypeConverterImpl()
46 internal class RelativeVector3TypeConverterImpl : RelativeVector3TypeConverter
48 public RelativeVector3TypeConverterImpl()
52 internal class RelativeVector4TypeConverterImpl : RelativeVector4TypeConverter
54 public RelativeVector4TypeConverterImpl()
61 tlog.Info(tag, "Init() is called!");
67 tlog.Info(tag, "Destroy() is called!");
72 [Description("Vector2TypeConverter ConvertFromInvariantString")]
73 [Property("SPEC", "Tizen.NUI.Vector2TypeConverter.ConvertFromInvariantString M")]
74 [Property("SPEC_URL", "-")]
75 [Property("CRITERIA", "MR")]
76 public void Vector2TypeConverterConvertFromInvariantString()
78 tlog.Debug(tag, $"Vector2TypeConverterConvertFromInvariantString START");
80 var testingTarget = new Vector2TypeConverterImpl();
81 Assert.IsNotNull(testingTarget, "Can't create success object Vector2TypeConverter.");
82 Assert.IsInstanceOf<Vector2TypeConverter>(testingTarget, "Should return Vector2TypeConverter instance.");
84 var result = testingTarget.ConvertFromInvariantString("100");
85 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
87 tlog.Debug(tag, $"Vector2TypeConverterConvertFromInvariantString END");
92 [Description("Vector2TypeConverter ConvertFromInvariantString")]
93 [Property("SPEC", "Tizen.NUI.Vector2TypeConverter.ConvertFromInvariantString M")]
94 [Property("SPEC_URL", "-")]
95 [Property("CRITERIA", "MR")]
96 public void Vector2TypeConverterConvertFromInvariantStringNullPath()
98 tlog.Debug(tag, $"Vector2TypeConverterConvertFromInvariantStringNullPath START");
100 var testingTarget = new Vector2TypeConverterImpl();
101 Assert.IsNotNull(testingTarget, "Can't create success object Vector2TypeConverter.");
102 Assert.IsInstanceOf<Vector2TypeConverter>(testingTarget, "Should return Vector2TypeConverter instance.");
107 var result = testingTarget.ConvertFromInvariantString(str);
109 catch (InvalidOperationException)
111 tlog.Debug(tag, $"Vector2TypeConverterConvertFromInvariantStringNullPath END");
112 Assert.Pass("Caught InvalidOperationException : Passed!");
118 [Description("Vector2TypeConverter ConvertToString")]
119 [Property("SPEC", "Tizen.NUI.Vector2TypeConverter.ConvertToString M")]
120 [Property("SPEC_URL", "-")]
121 [Property("CRITERIA", "MR")]
122 public void Vector2TypeConverterConvertToString()
124 tlog.Debug(tag, $"Vector2TypeConverterConvertToString START");
126 var testingTarget = new Vector2TypeConverterImpl();
127 Assert.IsNotNull(testingTarget, "Can't create success object Vector2TypeConverter.");
128 Assert.IsInstanceOf<Vector2TypeConverter>(testingTarget, "Should return Vector2TypeConverter instance.");
130 var result = testingTarget.ConvertToString(0.3f);
131 tlog.Debug(tag, "ConvertToString : " + result);
133 tlog.Debug(tag, $"Vector2TypeConverterConvertToString END");
138 [Description("Vector2TypeConverter FromString")]
139 [Property("SPEC", "Tizen.NUI.Vector2TypeConverter.FromString M")]
140 [Property("SPEC_URL", "-")]
141 [Property("CRITERIA", "MR")]
142 public void Vector2TypeConverterFromString()
144 tlog.Debug(tag, $"Vector2TypeConverterFromString START");
147 var result = Vector2TypeConverter.FromString("100, 50");
148 tlog.Debug(tag, "FromString : " + result);
151 result = Vector2TypeConverter.FromString("100");
152 tlog.Debug(tag, "FromString : " + result);
154 tlog.Debug(tag, $"Vector2TypeConverterFromString END");
159 [Description("Vector2TypeConverter InvalidOperationException")]
160 [Property("SPEC", "Tizen.NUI.Vector2TypeConverter.FromString M")]
161 [Property("SPEC_URL", "-")]
162 [Property("CRITERIA", "MR")]
163 public void Vector2TypeConverterFromStringInvalidOperationException()
165 tlog.Debug(tag, $"Vector2TypeConverterFromStringInvalidOperationException START");
170 Vector2TypeConverter.FromString("100, 50, 0.0f");
172 catch (InvalidOperationException)
174 tlog.Debug(tag, $"Vector2TypeConverterFromStringInvalidOperationException END");
175 Assert.Pass("Caught InvalidOperationException : Passed!");
181 [Description("Vector2TypeConverter ToString")]
182 [Property("SPEC", "Tizen.NUI.Vector2TypeConverter.ToString M")]
183 [Property("SPEC_URL", "-")]
184 [Property("CRITERIA", "MR")]
185 public void Vector2TypeConverterToString()
187 tlog.Debug(tag, $"Vector2TypeConverterToString START");
189 using (Vector2 vec = new Vector2(100, 50))
191 var result = Vector2TypeConverter.ToString(vec);
192 tlog.Debug(tag, "ToString : " + result);
196 Assert.AreEqual(null, Vector2TypeConverter.ToString(val), "should be equal!");
198 tlog.Debug(tag, $"Vector2TypeConverterToString END");
203 [Description("Vector3TypeConverter ConvertFromInvariantString")]
204 [Property("SPEC", "Tizen.NUI.Vector3TypeConverter.ConvertFromInvariantString M")]
205 [Property("SPEC_URL", "-")]
206 [Property("CRITERIA", "MR")]
207 public void Vector3TypeConverterConvertFromInvariantString()
209 tlog.Debug(tag, $"Vector3TypeConverterConvertFromInvariantString START");
211 var testingTarget = new Vector3TypeConverterImpl();
212 Assert.IsNotNull(testingTarget, "Can't create success object Vector3TypeConverter.");
213 Assert.IsInstanceOf<Vector3TypeConverter>(testingTarget, "Should return Vector3TypeConverter instance.");
216 var result = testingTarget.ConvertFromInvariantString("100, 50, 30");
217 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
220 result = testingTarget.ConvertFromInvariantString("100, 50");
221 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
224 result = testingTarget.ConvertFromInvariantString("100");
225 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
230 result = testingTarget.ConvertFromInvariantString("100, 50, 30, 0.3f");
232 catch (InvalidOperationException)
234 tlog.Debug(tag, $"Vector3TypeConverterConvertFromInvariantString END");
235 Assert.Pass("Caught InvalidOperationException : Passed!");
241 [Description("Vector3TypeConverter ConvertToString")]
242 [Property("SPEC", "Tizen.NUI.Vector3TypeConverter.ConvertToString M")]
243 [Property("SPEC_URL", "-")]
244 [Property("CRITERIA", "MR")]
245 public void Vector3TypeConverterConvertToString()
247 tlog.Debug(tag, $"Vector3TypeConverterConvertToString START");
249 var testingTarget = new Vector3TypeConverterImpl();
250 Assert.IsNotNull(testingTarget, "Can't create success object Vector3TypeConverter.");
251 Assert.IsInstanceOf<Vector3TypeConverter>(testingTarget, "Should return Vector3TypeConverter instance.");
254 var result = testingTarget.ConvertToString(0.3f);
255 tlog.Debug(tag, "ConvertToString : " + result);
257 using (Vector3 vec = new Vector3(0.1f, 0.3f, 0.5f))
259 result = testingTarget.ConvertToString(vec);
260 tlog.Debug(tag, "ConvertToString : " + result);
263 tlog.Debug(tag, $"Vector3TypeConverterConvertToString END");
268 [Description("Vector4TypeConverter ConvertFromInvariantString")]
269 [Property("SPEC", "Tizen.NUI.Vector4TypeConverter.ConvertFromInvariantString M")]
270 [Property("SPEC_URL", "-")]
271 [Property("CRITERIA", "MR")]
272 public void Vector4TypeConverterConvertFromInvariantString()
274 tlog.Debug(tag, $"Vector4TypeConverterConvertFromInvariantString START");
276 var testingTarget = new Vector4TypeConverterImpl();
277 Assert.IsNotNull(testingTarget, "Can't create success object Vector4TypeConverter.");
278 Assert.IsInstanceOf<Vector4TypeConverter>(testingTarget, "Should return Vector4TypeConverter instance.");
281 var result = testingTarget.ConvertFromInvariantString("100, 50, 30, 10");
282 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
285 result = testingTarget.ConvertFromInvariantString("100, 50, 30");
286 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
289 result = testingTarget.ConvertFromInvariantString("100, 50");
290 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
293 result = testingTarget.ConvertFromInvariantString("100");
294 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
299 result = testingTarget.ConvertFromInvariantString("100, 50, 30, 10, 0.3f");
301 catch (InvalidOperationException)
303 tlog.Debug(tag, $"Vector4TypeConverterConvertFromInvariantString END");
304 Assert.Pass("Caught InvalidOperationException : Passed!");
310 [Description("Vector4TypeConverter ConvertToString")]
311 [Property("SPEC", "Tizen.NUI.Vector4TypeConverter.ConvertToString M")]
312 [Property("SPEC_URL", "-")]
313 [Property("CRITERIA", "MR")]
314 public void Vector4TypeConverterConvertToString()
316 tlog.Debug(tag, $"Vector4TypeConverterConvertToString START");
318 var testingTarget = new Vector4TypeConverterImpl();
319 Assert.IsNotNull(testingTarget, "Can't create success object Vector4TypeConverter.");
320 Assert.IsInstanceOf<Vector4TypeConverter>(testingTarget, "Should return Vector4TypeConverter instance.");
323 var result = testingTarget.ConvertToString(0.3f);
324 tlog.Debug(tag, "ConvertToString : " + result);
326 using (Vector4 vec = new Vector4(0.1f, 0.3f, 0.5f, 0.0f))
328 result = testingTarget.ConvertToString(vec);
329 tlog.Debug(tag, "ConvertToString : " + result);
332 tlog.Debug(tag, $"Vector4TypeConverterConvertToString END");
337 [Description("RelativeVector2TypeConverter ConvertFromInvariantString")]
338 [Property("SPEC", "Tizen.NUI.RelativeVector2TypeConverter.ConvertFromInvariantString M")]
339 [Property("SPEC_URL", "-")]
340 [Property("CRITERIA", "MR")]
341 public void RelativeVector2TypeConverterConvertFromInvariantString()
343 tlog.Debug(tag, $"RelativeVector2TypeConverterConvertFromInvariantString START");
345 var testingTarget = new RelativeVector2TypeConverterImpl();
346 Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector2TypeConverter.");
347 Assert.IsInstanceOf<RelativeVector2TypeConverter>(testingTarget, "Should return RelativeVector2TypeConverter instance.");
350 var result = testingTarget.ConvertFromInvariantString("100, 50");
351 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
354 result = testingTarget.ConvertFromInvariantString("100");
355 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
360 result = testingTarget.ConvertFromInvariantString("100, 50, 30");
362 catch (InvalidOperationException)
364 tlog.Debug(tag, $"RelativeVector2TypeConverterConvertFromInvariantString END");
365 Assert.Pass("Caught InvalidOperationException : Passed!");
371 [Description("RelativeVector2TypeConverter ConvertToString")]
372 [Property("SPEC", "Tizen.NUI.RelativeVector2TypeConverter.ConvertToString M")]
373 [Property("SPEC_URL", "-")]
374 [Property("CRITERIA", "MR")]
375 public void RelativeVector2TypeConverterConvertToString()
377 tlog.Debug(tag, $"RelativeVector2TypeConverterConvertToString START");
379 var testingTarget = new RelativeVector2TypeConverterImpl();
380 Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector2TypeConverter.");
381 Assert.IsInstanceOf<RelativeVector2TypeConverter>(testingTarget, "Should return RelativeVector2TypeConverter instance.");
384 var result = testingTarget.ConvertToString(0.3f);
385 tlog.Debug(tag, "ConvertToString : " + result);
387 using (RelativeVector2 vec = new RelativeVector2(0.1f, 0.3f))
389 result = testingTarget.ConvertToString(vec);
390 tlog.Debug(tag, "ConvertToString : " + result);
393 tlog.Debug(tag, $"RelativeVector2TypeConverterConvertToString END");
398 [Description("RelativeVector3TypeConverter ConvertFromInvariantString")]
399 [Property("SPEC", "Tizen.NUI.RelativeVector3TypeConverter.ConvertFromInvariantString M")]
400 [Property("SPEC_URL", "-")]
401 [Property("CRITERIA", "MR")]
402 public void RelativeVector3TypeConverterConvertFromInvariantString()
404 tlog.Debug(tag, $"RelativeVector3TypeConverterConvertFromInvariantString START");
406 var testingTarget = new RelativeVector3TypeConverterImpl();
407 Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3TypeConverter.");
408 Assert.IsInstanceOf<RelativeVector3TypeConverter>(testingTarget, "Should return RelativeVector3TypeConverter instance.");
411 var result = testingTarget.ConvertFromInvariantString("100, 50, 30");
412 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
415 result = testingTarget.ConvertFromInvariantString("100, 50");
416 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
419 result = testingTarget.ConvertFromInvariantString("100");
420 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
425 result = testingTarget.ConvertFromInvariantString("100, 50, 30, 10");
427 catch (InvalidOperationException)
429 tlog.Debug(tag, $"RelativeVector3TypeConverterConvertFromInvariantString END");
430 Assert.Pass("Caught InvalidOperationException : Passed!");
436 [Description("RelativeVector3TypeConverter ConvertToString")]
437 [Property("SPEC", "Tizen.NUI.RelativeVector3TypeConverter.ConvertToString M")]
438 [Property("SPEC_URL", "-")]
439 [Property("CRITERIA", "MR")]
440 public void RelativeVector3TypeConverterConvertToString()
442 tlog.Debug(tag, $"RelativeVector3TypeConverterConvertToString START");
444 var testingTarget = new RelativeVector3TypeConverterImpl();
445 Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector3TypeConverter.");
446 Assert.IsInstanceOf<RelativeVector3TypeConverter>(testingTarget, "Should return RelativeVector3TypeConverter instance.");
449 var result = testingTarget.ConvertToString(0.3f);
450 tlog.Debug(tag, "ConvertToString : " + result);
452 using (RelativeVector3 vec = new RelativeVector3(0.1f, 0.3f, 0.5f))
454 result = testingTarget.ConvertToString(vec);
455 tlog.Debug(tag, "ConvertToString : " + result);
458 tlog.Debug(tag, $"RelativeVector3TypeConverterConvertToString END");
463 [Description("RelativeVector4TypeConverter ConvertFromInvariantString")]
464 [Property("SPEC", "Tizen.NUI.RelativeVector4TypeConverter.ConvertFromInvariantString M")]
465 [Property("SPEC_URL", "-")]
466 [Property("CRITERIA", "MR")]
467 public void RelativeVector4TypeConverterConvertFromInvariantString()
469 tlog.Debug(tag, $"RelativeVector4TypeConverterConvertFromInvariantString START");
471 var testingTarget = new RelativeVector4TypeConverterImpl();
472 Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4TypeConverter.");
473 Assert.IsInstanceOf<RelativeVector4TypeConverter>(testingTarget, "Should return RelativeVector4TypeConverter instance.");
476 var result = testingTarget.ConvertFromInvariantString("100, 50, 30, 10");
477 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
480 result = testingTarget.ConvertFromInvariantString("100, 50, 30");
481 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
484 result = testingTarget.ConvertFromInvariantString("100, 50");
485 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
488 result = testingTarget.ConvertFromInvariantString("100");
489 tlog.Debug(tag, "ConvertFromInvariantString : " + result);
494 result = testingTarget.ConvertFromInvariantString("100, 50, 30, 10, 0.3f");
496 catch (InvalidOperationException)
498 tlog.Debug(tag, $"RelativeVector4TypeConverterConvertFromInvariantString END");
499 Assert.Pass("Caught InvalidOperationException : Passed!");
505 [Description("RelativeVector4TypeConverter ConvertToString")]
506 [Property("SPEC", "Tizen.NUI.RelativeVector4TypeConverter.ConvertToString M")]
507 [Property("SPEC_URL", "-")]
508 [Property("CRITERIA", "MR")]
509 public void RelativeVector4TypeConverterConvertToString()
511 tlog.Debug(tag, $"RelativeVector4TypeConverterConvertToString START");
513 var testingTarget = new RelativeVector4TypeConverterImpl();
514 Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4TypeConverter.");
515 Assert.IsInstanceOf<RelativeVector4TypeConverter>(testingTarget, "Should return RelativeVector4TypeConverter instance.");
518 var result = testingTarget.ConvertToString(0.3f);
519 tlog.Debug(tag, "ConvertToString : " + result);
521 using (RelativeVector4 vec = new RelativeVector4(0.1f, 0.3f, 0.5f, 0.0f))
523 result = testingTarget.ConvertToString(vec);
524 tlog.Debug(tag, "ConvertToString : " + result);
527 tlog.Debug(tag, $"RelativeVector4TypeConverterConvertToString END");