Merge "Changed 'virtual' function override declarations to 'override' in automated...
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-Window.cpp
index 3a082ef..b02764a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 #include <dali/dali.h>
-#include <Ecore_X.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/internal/system/linux/dali-ecore-x.h>
 #include <dali-test-suite-utils.h>
 
+
 using namespace Dali;
 
 void utc_dali_window_startup(void)
@@ -60,14 +62,14 @@ Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int
 
 }
 
-int UtcDaliToolkitWindowConstructorP(void)
+int UtcDaliWindowConstructorP(void)
 {
   Dali::Window window;
   DALI_TEST_CHECK( !window );
   END_TEST;
 }
 
-int UtcDaliToolkitWindowCopyConstructorP(void)
+int UtcDaliWindowCopyConstructorP(void)
 {
   Dali::Window window;
   Dali::Window copy( window );
@@ -76,10 +78,21 @@ int UtcDaliToolkitWindowCopyConstructorP(void)
   END_TEST;
 }
 
-int UtcDaliToolkitWindowAssignmentOperatorP(void)
+int UtcDaliWindowConstructorFromInternalPointerN(void)
 {
-  Dali::Window window;
-  Dali::Window copy = window;
+  Internal::Adaptor::Window* internalWindow = NULL;
+  Dali::Window window(internalWindow);
+  DALI_TEST_CHECK( !window ); // Should not reach here!
+
+  END_TEST;
+}
+
+int UtcDaliWindowAssignmentOperatorP(void)
+{
+  const Dali::Window window;
+  Dali::Window copy;
+  DALI_TEST_CHECK( ! copy );
+  copy = window;
   DALI_TEST_CHECK( copy == window );
 
   END_TEST;
@@ -109,10 +122,210 @@ int UtcDaliWindowNewN(void)
     DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
   }
 
+  // Attempt to create a new window
+  try
+  {
+    PositionSize windowPosition(0, 0, 0, 0);
+    Dali::Window window = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
+
+    tet_result( TET_FAIL );
+  }
+  catch ( DaliException& e )
+  {
+    DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowSetClassN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.SetClass("window-name", "window-class");
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowRaiseN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.Raise();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowLowerN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.Lower();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowActivateN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.Activate();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowAddAvailableOrientationN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.AddAvailableOrientation(Dali::Window::PORTRAIT);
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
   END_TEST;
 }
 
+int UtcDaliWindowRemoveAvailableOrientationN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
 
+  END_TEST;
+}
 
+int UtcDaliWindowSetPreferredOrientationN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.SetPreferredOrientation(Dali::Window::PORTRAIT);
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
 
+  END_TEST;
+}
 
+int UtcDaliWindowGetPreferredOrientationN(void)
+{
+  Dali::Window window;
+  try
+  {
+    Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
+    DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowGetNativeHandleN(void)
+{
+  Dali::Window window;
+  try
+  {
+    Dali::Any handle = window.GetNativeHandle();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowSetAcceptFocusN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.SetAcceptFocus( true );
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowIsFocusAcceptableN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.IsFocusAcceptable();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWindowFocusChangeSignalN(void)
+{
+  Dali::Window window;
+  try
+  {
+    window.FocusChangeSignal();
+    DALI_TEST_CHECK( false ); // Should not reach here!
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( true );
+  }
+
+  END_TEST;
+}