2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
17 using NUnit.Framework;
18 using NUnit.Framework.TUnit;
20 using System.Threading;
21 using System.Threading.Tasks;
25 using Tizen.Applications.Notifications;
26 using Tizen.Applications.NotificationEventListener;
28 namespace Tizen.Applications.NotificationEventListener.Tests
31 [Description("NotificationEventArgs.LockStyleArgs Api Tests")]
32 public class NotificationEventArgsLockStyleArgsTests
34 private static string _iconpath;
35 private static string _thumbnail;
38 public static void Init()
40 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
44 public static void Destroy()
46 LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
49 private static void ChangedEventForIconPath(object sender, NotificationEventArgs args)
51 NotificationEventArgs.LockStyleArgs style = args.GetStyle<NotificationEventArgs.LockStyleArgs>();
52 _iconpath = style.IconPath;
55 private static void ChangedEventForThumbnail(object sender, NotificationEventArgs args)
57 NotificationEventArgs.LockStyleArgs style = args.GetStyle<NotificationEventArgs.LockStyleArgs>();
58 _thumbnail = style.Thumbnail;
63 [Description("LockStyleArgs constructor")]
64 [Property("SPEC", "Tizen.Applications.NotificationEventListener.NotificationEventArgs.LockStyleArgs.LockStyleArgs C")]
65 [Property("SPEC_URL", "-")]
66 [Property("CRITERIA", "CONSTR")]
67 [Property("AUTHOR", "MyungKi Lee, mk5004.lee@samsung.com")]
68 public static void LockStyleArgs_INIT()
70 NotificationEventArgs.LockStyleArgs lockStyle = new NotificationEventArgs.LockStyleArgs();
71 Assert.IsInstanceOf<NotificationEventArgs.LockStyleArgs>(lockStyle, "LockStyleArgs object is not of correct instance");
76 [Description("Check whether IconPath returns expected value or not")]
77 [Property("SPEC", "Tizen.Applications.NotificationEventListener.NotificationEventArgs.LockStyleArgs.IconPath A")]
78 [Property("SPEC_URL", "-")]
79 [Property("CRITERIA", "PRO")]
80 [Property("AUTHOR", "MyungKi Lee, mk5004.lee@samsung.com")]
81 public static async Task IconPath_PROPERTY_READ_ONLY()
85 NotificationListenerManager.Added += ChangedEventForIconPath;
87 Notification noti = new Notification
89 Title = "Notification"
92 Notification.LockStyle style = new Notification.LockStyle();
93 style.IconPath = "IconPath";
94 style.ThumbnailPath = "ThumbnailPath";
98 NotificationManager.Post(noti);
99 await Task.Delay(1000);
101 Assert.AreEqual(_iconpath, "IconPath", "the set value and the get value should be equal");
103 NotificationManager.Delete(noti);
105 NotificationListenerManager.Added -= ChangedEventForIconPath;
109 Assert.True(false, e.Message);
115 [Description("Check whether Thumbnail returns expected value or not")]
116 [Property("SPEC", "Tizen.Applications.NotificationEventListener.NotificationEventArgs.LockStyleArgs.Thumbnail A")]
117 [Property("SPEC_URL", "-")]
118 [Property("CRITERIA", "PRO")]
119 [Property("AUTHOR", "MyungKi Lee, mk5004.lee@samsung.com")]
120 public static async Task Thumbnail_PROPERTY_READ_ONLY()
124 NotificationListenerManager.Added += ChangedEventForThumbnail;
126 Notification noti = new Notification
128 Title = "Notification"
131 Notification.LockStyle style = new Notification.LockStyle();
132 style.IconPath = "IconPath";
133 style.ThumbnailPath = "ThumbnailPath";
135 noti.AddStyle(style);
137 NotificationManager.Post(noti);
138 await Task.Delay(1000);
140 Assert.AreEqual(_thumbnail, "ThumbnailPath", "the set value and the get value should be equal");
142 NotificationManager.Delete(noti);
144 NotificationListenerManager.Added -= ChangedEventForThumbnail;
148 Assert.True(false, e.Message);