[NUI] Add xaml binding testcases
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / XamlBinding / TSDeviceInfo.cs
1 using global::System;
2 using NUnit.Framework;
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;
9
10 namespace Tizen.NUI.Devel.Tests
11 {
12     using tlog = Tizen.Log;
13
14     [TestFixture]
15     [Description("internal/XamlBinding/DeviceInfo")]
16     public class InternalDeviceInfoTest
17     {
18         private const string tag = "NUITEST";
19
20         internal class MyDeviceInfo : DeviceInfo
21         {
22             public override Size PixelScreenSize => new Size(100,100);
23
24             public override Size ScaledScreenSize => new Size(100, 100);
25
26             public override double ScalingFactor => 1.0f;
27         }
28
29         [SetUp]
30         public void Init()
31         {
32             tlog.Info(tag, "Init() is called!");
33         }
34
35         [TearDown]
36         public void Destroy()
37         {
38             tlog.Info(tag, "Destroy() is called!");
39         }
40
41         [Test]
42         [Category("P1")]
43         [Description("DeviceInfo constructor")]
44         [Property("SPEC", "Tizen.NUI.Binding.DeviceInfo.DeviceInfo C")]
45         [Property("SPEC_URL", "-")]
46         [Property("CRITERIA", "CONSTR")]
47         public void DeviceInfoConstructor()
48         {
49             tlog.Debug(tag, $"DeviceInfoConstructor START");
50
51             var testingTarget = new MyDeviceInfo();
52             Assert.IsNotNull(testingTarget, "Can't create success object DeviceInfo.");
53             Assert.IsInstanceOf<MyDeviceInfo>(testingTarget, "Should return DeviceInfo instance.");
54
55             Assert.AreEqual(1.0, testingTarget.DisplayRound(1.0), "Should be equal");
56             var ret = testingTarget.CurrentOrientation;
57             testingTarget.CurrentOrientation = ret;
58             Assert.AreEqual(ret, testingTarget.CurrentOrientation, "Should be equal");
59             testingTarget.CurrentOrientation = DeviceOrientation.Other;
60             Assert.AreEqual(DeviceOrientation.Other, testingTarget.CurrentOrientation, "Should be equal");
61
62             testingTarget.Dispose();
63             tlog.Debug(tag, $"DeviceInfoConstructor END");
64         }
65     }
66 }