Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Utility / TSColorHistogram.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
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("Internal/Utility/ColorHistogram")]
13     public class InternalColorHistogramTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("ColorHistogram constructor.")]
32         [Property("SPEC", "Tizen.NUI.ColorHistogram.ColorHistogram C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void ColorHistogramConstructor()
37         {
38             tlog.Debug(tag, $"ColorHistogramConstructor START");
39
40             int[] pixels = new int[3] { 16, 4, 20 };
41             var testingTarget = new ColorHistogram(pixels);
42             Assert.IsNotNull(testingTarget, "Should be not null!");
43             Assert.IsInstanceOf<ColorHistogram>(testingTarget, "Should be an Instance of ColorHistogram!");
44
45             tlog.Debug(tag, $"ColorHistogramConstructor END (OK)");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("ColorHistogram GetNumberOfColors.")]
51         [Property("SPEC", "Tizen.NUI.ColorHistogram.GetNumberOfColors M")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "MR")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void ColorHistogramGetNumberOfColors()
56         {
57             tlog.Debug(tag, $"ColorHistogramGetNumberOfColors START");
58
59             int[] pixels = new int[3] { 16, 4, 20 };
60             var testingTarget = new ColorHistogram(pixels);
61             Assert.IsNotNull(testingTarget, "Should be not null!");
62             Assert.IsInstanceOf<ColorHistogram>(testingTarget, "Should be an Instance of ColorHistogram!");
63
64             try
65             {
66                 testingTarget.GetNumberOfColors();
67                 tlog.Debug(tag, "numberColors :" + testingTarget.GetNumberOfColors());
68             }
69             catch (Exception e)
70             {
71                 tlog.Debug(tag, e.Message.ToString());
72                 Assert.Fail("Caught Exception: Failed!");
73             }
74
75             tlog.Debug(tag, $"ColorHistogramGetNumberOfColors END (OK)");
76         }
77
78         [Test]
79         [Category("P1")]
80         [Description("ColorHistogram GetColors.")]
81         [Property("SPEC", "Tizen.NUI.ColorHistogram.GetColors M")]
82         [Property("SPEC_URL", "-")]
83         [Property("CRITERIA", "MR")]
84         [Property("AUTHOR", "guowei.wang@samsung.com")]
85         public void ColorHistogramGetColors()
86         {
87             tlog.Debug(tag, $"ColorHistogramGetColors START");
88
89             int[] pixels = new int[3] { 16, 4, 20 };
90             var testingTarget = new ColorHistogram(pixels);
91             Assert.IsNotNull(testingTarget, "Should be not null!");
92             Assert.IsInstanceOf<ColorHistogram>(testingTarget, "Should be an Instance of ColorHistogram!");
93
94             try
95             {
96                 testingTarget.GetColors();
97                 tlog.Debug(tag, "colors :" + testingTarget.GetColors());
98             }
99             catch (Exception e)
100             {
101                 tlog.Debug(tag, e.Message.ToString());
102                 Assert.Fail("Caught Exception: Failed!");
103             }
104
105             tlog.Debug(tag, $"ColorHistogramGetColors END (OK)");
106         }
107
108         [Test]
109         [Category("P1")]
110         [Description("ColorHistogram GetColorCounts.")]
111         [Property("SPEC", "Tizen.NUI.ColorHistogram.GetColorCounts M")]
112         [Property("SPEC_URL", "-")]
113         [Property("CRITERIA", "MR")]
114         [Property("AUTHOR", "guowei.wang@samsung.com")]
115         public void ColorHistogramGetColorCounts()
116         {
117             tlog.Debug(tag, $"ColorHistogramGetColorCounts START");
118
119             int[] pixels = new int[3] { 16, 4, 20 };
120             var testingTarget = new ColorHistogram(pixels);
121             Assert.IsNotNull(testingTarget, "Should be not null!");
122             Assert.IsInstanceOf<ColorHistogram>(testingTarget, "Should be an Instance of ColorHistogram!");
123
124             try
125             {
126                 testingTarget.GetColorCounts();
127                 tlog.Debug(tag, "colorCounts :" + testingTarget.GetColorCounts());
128             }
129             catch (Exception e)
130             {
131                 tlog.Debug(tag, e.Message.ToString());
132                 Assert.Fail("Caught Exception: Failed!");
133             }
134
135             tlog.Debug(tag, $"ColorHistogramGetColorCounts END (OK)");
136         }
137     }
138 }