using NUnit.Framework;
using NUnit.Framework.TUnit;
using System;
+using Tizen.System;
namespace Tizen.WidgetControl.Tests
{
public class WidgetControlTests
{
private static Tizen.Applications.WidgetControl _widgetControl;
+ private static Tizen.Applications.WidgetControl _widgetControl2;
+ private static Tizen.Applications.WidgetControl _widgetControl3;
+
private const string MyWidgetId = "org.tizen.WidgetCtrlSample";
private const string MyWidgetId1 = "org.tizen.WidgetCtrlSample1";
+ private const string MyWidgetId2 = "org.tizen.WidgetCtrlSample2";
private const string Lang = "en_US";
private const string TAG = "WidgetControlTest";
+ static bool isWidgetSupported = false;
+
private static void OnCreated(object sender, Tizen.Applications.WidgetLifecycleEventArgs args)
{
}
public void Init()
{
_widgetControl = new Tizen.Applications.WidgetControl(MyWidgetId);
+ _widgetControl2 = new Tizen.Applications.WidgetControl(MyWidgetId2);
+ _widgetControl3 = new Tizen.Applications.WidgetControl("");
+
+ Information.TryGetValue("http://tizen.org/feature/shell.appwidget", out isWidgetSupported);
LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");
}
public void Destroy()
{
_widgetControl = null;
+ _widgetControl2 = null;
+ _widgetControl3 = null;
LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");
}
Assert.IsInstanceOf<string>(_widgetControl.PackageId);
Assert.AreEqual(_widgetControl.PackageId, "WidgetCtrlSample.Tizen");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Check whether SetupAppId value is valid")]
+ [Property("SPEC", "Tizen.Applications.WidgetControl.SetupAppId A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void SetupAppId_PROPERTY_GET()
+ {
+ try
+ {
+ Assert.IsInstanceOf<string>(_widgetControl2.SetupAppId);
+ Assert.AreEqual(_widgetControl2.SetupAppId, "org.tizen.setupappid");
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(isWidgetSupported == false, "Invalid NotSupportedException");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("There should be no exception " + e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : Check whether SetupAppId value is valid")]
+ [Property("SPEC", "Tizen.Applications.WidgetControl.SetupAppId A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void SetupAppId_INVALID_OPERATION_EXCEPTION()
+ {
+ try
+ {
+ Assert.Throws<InvalidOperationException>(delegate
+ {
+ string id = _widgetControl3.SetupAppId;
+ });
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(isWidgetSupported == false, "Invalid NotSupportedException");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("There should be no exception " + e.ToString());
+ }
+ }
}
}