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("public/BaseComponents/ImageView")]
13 public class InternalImageViewTest
15 private const string tag = "NUITEST";
16 private string image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Image.png";
17 private string mask_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "star-mod.png";
22 tlog.Info(tag, "Init() is called!");
28 tlog.Info(tag, "Destroy() is called!");
33 [Description("internal API test in Ubuntu, ImageView.ResourceUrl")]
34 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.ResourceUrl")]
35 [Property("SPEC_URL", "-")]
36 [Property("CRITERIA", "PRO")]
37 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
38 public void ResourceUrl_SET_GET_VALUE()
41 ImageView testView = new ImageView();
42 string testUrl1 = "test1";
43 testView.ResourceUrl = testUrl1;
45 Assert.AreEqual(testView.ResourceUrl, testUrl1, "ResourceUrl is not equal");
52 [Description("internal API test in Ubuntu, ImageView.AlphaMaskURL")]
53 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.AlphaMaskURL")]
54 [Property("SPEC_URL", "-")]
55 [Property("CRITERIA", "PRO")]
56 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
57 public void AlphaMaskURL_SET_GET_VALUE()
60 ImageView testView = new ImageView(image_path);
61 string testUrl1 = "test1";
62 testView.AlphaMaskURL = testUrl1;
64 Assert.AreEqual(testView.AlphaMaskURL, testUrl1, "AlphaMaskURL is not equal");
71 [Description("internal API test in Ubuntu, ImageView.CropToMask")]
72 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.CropToMask")]
73 [Property("SPEC_URL", "-")]
74 [Property("CRITERIA", "PRO")]
75 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
76 public void CropToMask_SET_GET_VALUE()
79 ImageView testView = new ImageView(image_path);
81 Assert.AreEqual(testView.CropToMask, false, "CropToMask default is false when we don't set mask image url");
83 testView.CropToMask = true;
85 Assert.AreEqual(testView.CropToMask, true, "CropToMask is not updated");
87 testView.CropToMask = false;
89 Assert.AreEqual(testView.CropToMask, false, "CropToMask is not updated");
91 testView.AlphaMaskURL = mask_path;
93 Assert.AreEqual(testView.CropToMask, false, "CropToMask should not changed even we set mask image url");
100 [Description("internal API test in Ubuntu, ImageView.CropToMask with AlphaMaskURL")]
101 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.CropToMask")]
102 [Property("SPEC_URL", "-")]
103 [Property("CRITERIA", "PRO")]
104 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
105 public void CropToMask_DEFAULT_GET_VALUE()
108 ImageView testView = new ImageView(image_path);
110 Assert.AreEqual(testView.CropToMask, false, "CropToMask default is false when we don't set mask image url");
112 testView.AlphaMaskURL = image_path;
114 Assert.AreEqual(testView.CropToMask, true, "CropToMask default is true when we set mask image url");
121 [Description("internal API test in Ubuntu, ImageView.NaturalSize2D")]
122 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.NaturalSize2D")]
123 [Property("SPEC_URL", "-")]
124 [Property("CRITERIA", "PRO")]
125 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
126 public void NaturalSize2D_GET_VALUE()
129 ImageView testView = new ImageView();
130 testView.ResourceUrl = image_path;
131 Size2D result = new Size2D(212, 150); // The size of image_path image.
132 Size2D size = testView.NaturalSize2D;
134 Assert.AreEqual(result.Width, size.Width, "NaturalSize Width is not equal");
135 Assert.AreEqual(result.Height, size.Height, "NaturalSize Height is not equal");
143 [Description("internal API test in Ubuntu, ImageView.NaturalSize")]
144 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.NaturalSize")]
145 [Property("SPEC_URL", "-")]
146 [Property("CRITERIA", "PRO")]
147 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
148 public void NaturalSize_GET_VALUE()
151 ImageView testView = new ImageView();
152 testView.ResourceUrl = image_path;
153 Vector3 result = new Vector3(212, 150, 0); // The size of image_path image.
154 Vector3 size = testView.NaturalSize;
156 Assert.AreEqual(result.X, size.X, "NaturalSize Width is not equal");
157 Assert.AreEqual(result.Y, size.Y, "NaturalSize Height is not equal");
164 [Description("internal API test in Ubuntu, ImageView.NaturalSize")]
165 [Property("SPEC", "Tizen.NUI.BaseComponents.ImageView.NaturalSize")]
166 [Property("SPEC_URL", "-")]
167 [Property("CRITERIA", "PRO")]
168 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
169 public void NaturalSize_GET_VALUE_as_View_class()
172 ImageView testView = new ImageView();
173 testView.ResourceUrl = image_path;
174 Vector3 result = new Vector3(212, 150, 0); // The size of image_path image.
175 View testView2 = testView; // Convert class as View.
176 Vector3 size = testView2.NaturalSize; // Check whether virtual ImageView.GetNaturalSize() called well.
178 Assert.AreEqual(result.X, size.X, "NaturalSize Width is not equal");
179 Assert.AreEqual(result.Y, size.Y, "NaturalSize Height is not equal");