internal class PublicWindowTest
{
private const string tag = "NUITEST";
- private static Window myWin;
+ private Window win = null;
+ private Rectangle rec = null;
+
[SetUp]
public void Init()
{
- Rectangle r1 = new Rectangle(0, 0, 20, 20);
- myWin = new Window(r1);
tlog.Info(tag, "Init() is called!");
+
+ rec = new Rectangle(0, 0, 2, 2);
+ win = new Window(rec);
}
[TearDown]
public void Destroy()
{
- if (myWin != null)
+ rec.Dispose();
+ if (win != null)
{
- myWin.Destroy();
- myWin = null;
+ win.Destroy();
+ win = null;
}
+
tlog.Info(tag, "Destroy() is called!");
}
try
{
- myWin.WindowPositionSize = new Rectangle(1, 2, 3, 4);
+ using (Rectangle size = new Rectangle(1, 2, 3, 4))
+ {
+ win.WindowPositionSize = size;
+ tlog.Debug(tag, "WindowPositionSize : " + win.WindowPositionSize);
+ }
}
catch (Exception e)
{
try
{
- myWin.GetLayer(0);
+ win.GetLayer(0);
}
catch (Exception e)
{
try
{
- myWin.GetCurrentOrientation();
+ win.GetCurrentOrientation();
}
catch (Exception e)
{
tlog.Debug(tag, $"WindowGetCurrentOrientation END (OK)");
}
- //[Test]
- //[Category("P1")]
- //[Description("Window SetAvailableOrientations")]
- //[Property("SPEC", "Tizen.NUI.Window.SetAvailableOrientations M")]
- //[Property("SPEC_URL", "-")]
- //[Property("CRITERIA", "MR")]
- //public void WindowSetAvailableOrientations()
- //{
- // tlog.Debug(tag, $"WindowSetAvailableOrientations START");
- // try
- // {
- // List<Window.WindowOrientation> l1 = new List<Window.WindowOrientation>();
+ [Test]
+ [Category("P1")]
+ [Description("Window SetAvailableOrientations")]
+ [Property("SPEC", "Tizen.NUI.Window.SetAvailableOrientations M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowSetAvailableOrientations()
+ {
+ tlog.Debug(tag, $"WindowSetAvailableOrientations START");
+ try
+ {
+ List<Window.WindowOrientation> list = new List<Window.WindowOrientation>();
- // l1.Add(Window.WindowOrientation.Landscape);
- // l1.Add(Window.WindowOrientation.LandscapeInverse);
- // l1.Add(Window.WindowOrientation.NoOrientationPreference);
- // l1.Add(Window.WindowOrientation.Portrait);
- // l1.Add(Window.WindowOrientation.PortraitInverse);
+ list.Add(Window.WindowOrientation.Landscape);
+ list.Add(Window.WindowOrientation.LandscapeInverse);
+ list.Add(Window.WindowOrientation.NoOrientationPreference);
+ list.Add(Window.WindowOrientation.Portrait);
+ list.Add(Window.WindowOrientation.PortraitInverse);
- // myWin.SetAvailableOrientations(l1);
- // }
- // catch (Exception e)
- // {
- // Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
- // Assert.Fail("Caught Exception" + e.ToString());
- // }
+ win.SetAvailableOrientations(list);
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
- // tlog.Debug(tag, $"WindowSetAvailableOrientations END (OK)");
- // Assert.Pass("WindowSetAvailableOrientations");
- //}
+ tlog.Debug(tag, $"WindowSetAvailableOrientations END (OK)");
+ Assert.Pass("WindowSetAvailableOrientations");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Window SetAvailableOrientations")]
+ [Property("SPEC", "Tizen.NUI.Window.SetAvailableOrientations M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowSetAvailableOrientationsWithNullList()
+ {
+ tlog.Debug(tag, $"WindowSetAvailableOrientationsWithNullList START");
+
+ List<Window.WindowOrientation> list = null;
+
+ try
+ {
+ win.SetAvailableOrientations(list);
+ }
+ catch (ArgumentNullException e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ tlog.Debug(tag, $"WindowSetAvailableOrientationsWithNullList END (OK)");
+ Assert.Pass("Caught ArgumentNullException : Passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window SetPositionSizeWithOrientation")]
+ [Property("SPEC", "Tizen.NUI.Window.SetPositionSizeWithOrientation M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowSetPositionSizeWithOrientation()
+ {
+ tlog.Debug(tag, $"WindowSetPositionSizeWithOrientation START");
+
+ try
+ {
+ using (Rectangle positionSize = new Rectangle(1, 2, 3, 4))
+ {
+ win.SetPositionSizeWithOrientation(positionSize, Window.WindowOrientation.Landscape);
+ }
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"WindowSetPositionSizeWithOrientation END (OK)");
+ }
[Test]
[Category("P1")]
try
{
- myWin.GetNativeId();
+ win.GetNativeId();
}
catch (Exception e)
{
try
{
- myWin.GetNativeHandle();
+ win.GetNativeHandle();
}
catch (Exception e)
{
try
{
Layer layer = null;
- myWin.Add(layer);
+ win.Add(layer);
}
catch (ArgumentNullException e)
{
try
{
Layer layer = null;
- myWin.Remove(layer);
+ win.Remove(layer);
}
catch (ArgumentNullException e)
{
tlog.Debug(tag, $"WindowGetRenderTaskList START");
try
{
- myWin.GetRenderTaskList();
+ win.GetRenderTaskList();
}
catch (Exception e)
{
// tlog.Debug(tag, $"WindowGetObjectRegistry START");
// try
// {
- // myWin.GetObjectRegistry();
+ // win.GetObjectRegistry();
// }
// catch (Exception e)
// {
try
{
Size2D s1 = null;
- myWin.SetWindowSize(s1);
+ win.SetWindowSize(s1);
}
catch (ArgumentNullException e)
{
try
{
Position2D p1 = null;
- myWin.SetPosition(p1);
+ win.SetPosition(p1);
}
catch (ArgumentNullException e)
{
try
{
Rectangle r1 = new Rectangle(0, 0, 20, 20);
- myWin.SetPositionSize(r1);
+ win.SetPositionSize(r1);
}
catch (Exception e)
{
try
{
FrameUpdateCallbackInterface f1 = new FrameUpdateCallbackInterface();
- myWin.AddFrameUpdateCallback(f1);
+ win.AddFrameUpdateCallback(f1);
}
catch (Exception e)
{
try
{
FrameUpdateCallbackInterface f1 = new FrameUpdateCallbackInterface();
- myWin.RemoveFrameUpdateCallback(f1);
+ win.RemoveFrameUpdateCallback(f1);
}
catch (Exception e)
{
try
{
FrameCallbackType f1 = null;
- myWin.AddFrameRenderedCallback(f1, 1);
+ win.AddFrameRenderedCallback(f1, 1);
}
catch (ArgumentNullException e)
{
try
{
FrameCallbackType f1 = null;
- myWin.AddFramePresentedCallback(f1, 1);
+ win.AddFramePresentedCallback(f1, 1);
}
catch (ArgumentNullException e)
{
Assert.Pass("Caught ArgumentNullException : Passed!");
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Window Get")]
+ [Property("SPEC", "Tizen.NUI.Window.Get M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowGet()
+ {
+ tlog.Debug(tag, $"WindowGet START");
+
+ using (NUI.BaseComponents.View view = new NUI.BaseComponents.View() { Color = Color.Cyan })
+ {
+ NUIApplication.GetDefaultWindow().Add(view);
+
+ try
+ {
+ var result = Window.Get(view);
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ NUIApplication.GetDefaultWindow().Remove(view);
+ }
+
+ tlog.Debug(tag, $"WindowGet END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window EnableFloatingMode")]
+ [Property("SPEC", "Tizen.NUI.Window.EnableFloatingMode M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowEnableFloatingMode()
+ {
+ tlog.Debug(tag, $"WindowEnableFloatingMode START");
+
+ try
+ {
+ Window.Instance.EnableFloatingMode(true);
+
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+ tlog.Debug(tag, $"AddInputRegionTest END (OK)");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window RequestMoveToServer")]
+ [Property("SPEC", "Tizen.NUI.Window.RequestMoveToServer M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowRequestMoveToServer()
+ {
+ tlog.Debug(tag, $"WindowRequestMoveToServer START");
+
+ try
+ {
+ Window.Instance.RequestMoveToServer();
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+ tlog.Debug(tag, $"WindowRequestMoveToServer END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window RequestResizeToServer")]
+ [Property("SPEC", "Tizen.NUI.Window.RequestResizeToServer M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowRequestResizeToServer()
+ {
+ tlog.Debug(tag, $"WindowRequestResizeToServer START");
+
+ try
+ {
+ Window.Instance.RequestResizeToServer(ResizeDirection.Top);
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+ tlog.Debug(tag, $"WindowRequestMoveToServer END (OK)");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window AddInputRegion Test")]
+ [Property("SPEC", "Tizen.NUI.Window.AddInputRegion M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void AddInputRegionTest()
+ {
+ try
+ {
+ var window = Window.Instance;
+ Rectangle inputRegion = new Rectangle(0, 0, 720, 640);
+ window.AddInputRegion(inputRegion);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception : Failed!");
+ }
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("Window SubtractInputRegion Test")]
+ [Property("SPEC", "Tizen.NUI.Window.SubtractInputRegion M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void SubtractInputRegionTest()
+ {
+ try
+ {
+ var window = Window.Instance;
+ Rectangle addInputRegion = new Rectangle(0, 0, 720, 1280);
+ window.AddInputRegion(addInputRegion);
+
+ Rectangle subtractInputRegion = new Rectangle(0, 641, 720, 640);
+ window.SubtractInputRegion(subtractInputRegion);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"SubtractInputRegionTest END (OK)");
+ }
}
-}
\ No newline at end of file
+}