-/*\r
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License\r
- */\r
-\r
-using System.Threading.Tasks;\r
-using NUnit.Framework;\r
-using Tizen.Applications;\r
-using Tizen.Applications.EventManager;\r
-using Tizen.Applications.EventManager.SystemEvents;\r
-\r
-namespace Tizen.Applications.EventManager.Manual.Tests\r
-{\r
-\r
- [TestFixture]\r
- [Description("Tizen.Applications.EventManager.EventManagerEventReceiver Tests")]\r
- public class EventManagerEventReceiverTests\r
- {\r
-\r
- private string TAG = "Tizen.Application.EventManager";\r
- private string _message;\r
- EventReceiver receiver;\r
-\r
- [SetUp]\r
- public void Init()\r
- {\r
- }\r
-\r
- [TearDown]\r
- public void Destroy()\r
- {\r
- }\r
-\r
- void OnReceived(object sender, EventManagerEventArgs e)\r
- {\r
- if (e.Name == EarjackStatus.EventName)\r
- {\r
- Bundle eventData = e.Data;\r
- object aValue = eventData.GetItem(EarjackStatus.StatusKey);\r
- if (eventData.Is<string>(EarjackStatus.StatusKey))\r
- {\r
- string statusValue = (string)aValue;\r
-\r
- ToastMessage toast = new ToastMessage\r
- {\r
- Message = statusValue\r
- };\r
-\r
- toast.Post();\r
- }\r
- }\r
-\r
- receiver.Received -= OnReceived;\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("MANUAL TEST : EventReceiver add received event handler.")]\r
- [Property("SPEC", "Tizen.Applications.EventManager.EventReceiver.Received E")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "EVL")]\r
- [Property("AUTHOR", "inkyun kil, inkyun.kil@samsung.com")]\r
- [Precondition(1, "earjack is disconnected.")]\r
- [Step(1, "Click run TC")]\r
- [Step(2, "earjack is connected")]\r
- [Step(3, "check if toast message show \"connected\".")]\r
- public async Task Received_Add()\r
- {\r
-\r
- receiver = new EventReceiver(EarjackStatus.EventName);\r
- receiver.Received += OnReceived;\r
-\r
- // Waits for user confirmation.\r
- await ManualTest.WaitForConfirm();\r
- }\r
-\r
- [Test]\r
- [Category("P1")]\r
- [Description("MANUAL TEST : EventReceiver remove received event handler.")]\r
- [Property("SPEC", "Tizen.Applications.EventManager.EventReceiver.Received E")]\r
- [Property("SPEC_URL", "-")]\r
- [Property("CRITERIA", "EVL")]\r
- [Property("AUTHOR", "inkyun kil, inkyun.kil@samsung.com")]\r
- [Precondition(1, "earjack is disconnected.")]\r
- [Step(1, "Click run TC")]\r
- [Step(2, "earjack is connected")]\r
- [Step(3, "check if toast message doesn't show \"connected\".")]\r
- public async Task Received_Remove()\r
- {\r
-\r
- receiver = new EventReceiver(EarjackStatus.EventName);\r
- receiver.Received += OnReceived;\r
- receiver.Received -= OnReceived;\r
-\r
- // Waits for user confirmation.\r
- await ManualTest.WaitForConfirm();\r
- }\r
- }\r
-}\r
-\r
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using Tizen.Applications;
+using Tizen.Applications.EventManager;
+using Tizen.Applications.EventManager.SystemEvents;
+using Tizen.System;
+
+namespace Tizen.Applications.EventManager.Manual.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.Applications.EventManager.EventManagerEventReceiver Tests")]
+ public class EventManagerEventReceiverTests
+ {
+
+ private string TAG = "Tizen.Application.EventManager";
+ private string _message;
+ EventReceiver receiver;
+
+ [SetUp]
+ public void Init()
+ {
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ }
+
+ void OnReceived(object sender, EventManagerEventArgs e)
+ {
+ if (e.Name == EarjackStatus.EventName)
+ {
+ Bundle eventData = e.Data;
+ object aValue = eventData.GetItem(EarjackStatus.StatusKey);
+ if (eventData.Is<string>(EarjackStatus.StatusKey))
+ {
+ string statusValue = (string)aValue;
+
+ ToastMessage toast = new ToastMessage
+ {
+ Message = statusValue
+ };
+
+ toast.Post();
+ }
+ }
+
+ receiver.Received -= OnReceived;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MANUAL TEST : EventReceiver add received event handler.")]
+ [Property("SPEC", "Tizen.Applications.EventManager.EventReceiver.Received E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "inkyun kil, inkyun.kil@samsung.com")]
+ [Precondition(1, "This test can be tested only in mobile device.")]
+ [Precondition(2, "earjack is disconnected.")]
+ [Step(1, "Click run TC")]
+ [Step(2, "earjack is connected")]
+ [Step(3, "check if toast message show \"connected\".")]
+ public async Task Received_Add()
+ {
+ string profile;
+ bool canBeTested;
+
+ Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
+
+ // This TC will be tested only "mobile".
+ if (String.Compare(profile, "mobile", true) == 0)
+ canBeTested = true;
+ else
+ canBeTested = false;
+
+ if (canBeTested)
+ {
+ receiver = new EventReceiver(EarjackStatus.EventName);
+ receiver.Received += OnReceived;
+
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ }
+ else
+ {
+ Assert.Pass("Not Supported profile");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MANUAL TEST : EventReceiver remove received event handler.")]
+ [Property("SPEC", "Tizen.Applications.EventManager.EventReceiver.Received E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "inkyun kil, inkyun.kil@samsung.com")]
+ [Precondition(1, "This test can be tested only in mobile device.")]
+ [Precondition(2, "earjack is disconnected.")]
+ [Step(1, "Click run TC")]
+ [Step(2, "earjack is connected")]
+ [Step(3, "check if toast message doesn't show \"connected\".")]
+ public async Task Received_Remove()
+ {
+ string profile;
+ bool canBeTested;
+
+ Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
+
+ // This TC will be tested only "mobile".
+ if (String.Compare(profile, "mobile", true) == 0)
+ canBeTested = true;
+ else
+ canBeTested = false;
+
+ if (canBeTested)
+ {
+ receiver = new EventReceiver(EarjackStatus.EventName);
+ receiver.Received += OnReceived;
+ receiver.Received -= OnReceived;
+
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ }
+ else
+ {
+ Assert.Pass("Not Supported profile");
+ }
+ }
+ }
+}
+