3 using NUnit.Framework.TUnit;
5 using Tizen.NUI.Components;
6 using Tizen.NUI.BaseComponents;
8 namespace Tizen.NUI.Components.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("Control/Toast")]
14 public class ControlToastTest
16 private const string tag = "NUITEST";
19 internal class MyToast : Toast
21 public MyToast() : base()
24 public override void OnInitialize()
29 public void OnCreateViewStyle()
31 base.CreateViewStyle();
38 tlog.Info(tag, "Init() is called!");
44 tlog.Info(tag, "Destroy() is called!");
49 [Description("Toast constructor.")]
50 [Property("SPEC", "Tizen.NUI.Components.Toast.Toast C")]
51 [Property("SPEC_URL", "-")]
52 [Property("CRITERIA", "CONSTR")]
53 [Property("COVPARAM", "")]
54 [Property("AUTHOR", "guowei.wang@samsung.com")]
56 public void ToastConstructor()
58 tlog.Debug(tag, $"ToastConstructor START");
60 ToastStyle style = new ToastStyle()
62 BackgroundColor = Color.Cyan,
65 var testingTarget = new Toast(style);
66 Assert.IsNotNull(testingTarget, "null handle");
67 Assert.IsInstanceOf<Toast>(testingTarget, "Should return Toast instance.");
69 testingTarget.Dispose();
70 tlog.Debug(tag, $"ToastConstructor END (OK)");
75 [Description("Toast FromText.")]
76 [Property("SPEC", "Tizen.NUI.Components.Toast.FromText M")]
77 [Property("SPEC_URL", "-")]
78 [Property("CRITERIA", "MR")]
79 [Property("COVPARAM", "")]
80 [Property("AUTHOR", "guowei.wang@samsung.com")]
82 public void ToastFromText()
84 tlog.Debug(tag, $"ToastFromText START");
86 var testingTarget = Toast.FromText("Null parameter construction", 1000);
87 Assert.IsNotNull(testingTarget, "null handle");
88 Assert.IsInstanceOf<Toast>(testingTarget, "Should return Toast instance.");
90 testingTarget.Dispose();
91 tlog.Debug(tag, $"ToastFromText END (OK)");
96 [Description("Toast Duration.")]
97 [Property("SPEC", "Tizen.NUI.Components.Toast.Duration A")]
98 [Property("SPEC_URL", "-")]
99 [Property("CRITERIA", "PRW")]
100 [Property("COVPARAM", "")]
101 [Property("AUTHOR", "guowei.wang@samsung.com")]
103 public void ToastDuration()
105 tlog.Debug(tag, $"ToastDuration START");
107 var testingTarget = new MyToast();
108 Assert.IsNotNull(testingTarget, "null handle");
109 Assert.IsInstanceOf<Toast>(testingTarget, "Should return Toast instance.");
111 testingTarget.OnInitialize();
113 testingTarget.Duration = 10;
114 tlog.Debug(tag, "Duration : " + testingTarget.Duration);
116 testingTarget.TextLineSpace = 8;
117 tlog.Debug(tag, "testingTarget : " + testingTarget.TextLineSpace);
119 testingTarget.TextLineHeight = 15;
120 tlog.Debug(tag, "TextLineHeight : " + testingTarget.TextLineHeight);
122 testingTarget.TextPadding = new Extents(2, 2, 2, 2);
123 tlog.Debug(tag, "TextPadding : " + testingTarget.TextPadding);
125 testingTarget.Message = "Toast";
126 tlog.Debug(tag, "Message : " + testingTarget.Message);
128 testingTarget.TextAlignment = HorizontalAlignment.Center;
129 tlog.Debug(tag, "TextAlignment :" + testingTarget.TextAlignment);
131 testingTarget.TextArray = new string[2] { "microsoft", "perfomance" };
132 tlog.Debug(tag, "TextArray : " + testingTarget.TextArray);
134 testingTarget.PointSize = 15.0f;
135 tlog.Debug(tag, "PointSize : " + testingTarget.PointSize);
137 testingTarget.FontFamily = "BreezeSans";
138 tlog.Debug(tag, "FontFamily : " + testingTarget.FontFamily);
140 testingTarget.TextColor = Color.Yellow;
141 tlog.Debug(tag, "TextColor : " + testingTarget.TextColor);
145 testingTarget.Post(Window.Instance);
149 tlog.Debug(tag, e.Message.ToString());
150 Assert.Fail("Caught Exception : Failed!");
153 testingTarget.Dispose();
154 tlog.Debug(tag, $"ToastDuration END (OK)");
159 [Description("Toast CreateViewStyle.")]
160 [Property("SPEC", "Tizen.NUI.Components.Toast.CreateViewStyle M")]
161 [Property("SPEC_URL", "-")]
162 [Property("CRITERIA", "MR")]
163 [Property("COVPARAM", "")]
164 [Property("AUTHOR", "guowei.wang@samsung.com")]
166 public void ToastCreateViewStyle()
168 tlog.Debug(tag, $"ToastCreateViewStyle START");
170 var testingTarget = new MyToast();
171 Assert.IsNotNull(testingTarget, "null handle");
172 Assert.IsInstanceOf<Toast>(testingTarget, "Should return Toast instance.");
176 testingTarget.OnCreateViewStyle();
180 tlog.Debug(tag, e.Message.ToString());
181 Assert.Fail("Caught Exception : Failed!");
184 testingTarget.Dispose();
185 tlog.Debug(tag, $"ToastCreateViewStyle END (OK)");
190 [Description("Toast ApplyStyle.")]
191 [Property("SPEC", "Tizen.NUI.Components.Toast.ApplyStyle M")]
192 [Property("SPEC_URL", "-")]
193 [Property("CRITERIA", "MR")]
194 [Property("COVPARAM", "")]
195 [Property("AUTHOR", "guowei.wang@samsung.com")]
197 public void ToastApplyStyle()
199 tlog.Debug(tag, $"ToastApplyStyle START");
201 var testingTarget = new Toast();
202 Assert.IsNotNull(testingTarget, "null handle");
203 Assert.IsInstanceOf<Toast>(testingTarget, "Should return Toast instance.");
205 ToastStyle style = new ToastStyle()
207 Text = new TextLabelStyle()
209 Size = new Size(80, 30)
215 testingTarget.ApplyStyle(style);
219 tlog.Debug(tag, e.Message.ToString());
220 Assert.Fail("Caught Exception : Failed!");
223 testingTarget.Dispose();
224 tlog.Debug(tag, $"ToastApplyStyle END (OK)");