Merge "Use existing callback ID for recurring callbacks" into devel/master
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-Window.cpp
index 719808e..8a165d2 100644 (file)
  *
  */
 
+#include <dali-test-suite-utils.h>
 #include <dali/dali.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;
 
@@ -35,45 +34,42 @@ void utc_dali_window_cleanup(void)
 
 namespace
 {
-
 intptr_t screenId = 0; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_x_default_screen_get below without compilation warnings
 
 } // unnamed namespace
 
 extern "C"
 {
+  Ecore_X_Screen* ecore_x_default_screen_get(void)
+  {
+    screenId += 8;
+    return (Ecore_X_Screen*)screenId;
+  }
 
-Ecore_X_Screen* ecore_x_default_screen_get(void)
-{
-  screenId += 8;
-  return (Ecore_X_Screen*)screenId;
-}
-
-void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
-{
- *w = 100;
- *h = 100;
-}
-
-Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
-{
-  return 0;
-}
+  void ecore_x_screen_size_get(const Ecore_X_Screen* screen, int* w, int* h)
+  {
+    *w = 100;
+    *h = 100;
+  }
 
+  Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
+  {
+    return 0;
+  }
 }
 
 int UtcDaliWindowConstructorP(void)
 {
   Dali::Window window;
-  DALI_TEST_CHECK( !window );
+  DALI_TEST_CHECK(!window);
   END_TEST;
 }
 
 int UtcDaliWindowCopyConstructorP(void)
 {
   Dali::Window window;
-  Dali::Window copy( window );
-  DALI_TEST_CHECK( copy == window );
+  Dali::Window copy(window);
+  DALI_TEST_CHECK(copy == window);
 
   END_TEST;
 }
@@ -81,8 +77,8 @@ int UtcDaliWindowCopyConstructorP(void)
 int UtcDaliWindowConstructorFromInternalPointerN(void)
 {
   Internal::Adaptor::Window* internalWindow = NULL;
-  Dali::Window window(internalWindow);
-  DALI_TEST_CHECK( !window ); // Should not reach here!
+  Dali::Window               window(internalWindow);
+  DALI_TEST_CHECK(!window); // Should not reach here!
 
   END_TEST;
 }
@@ -90,10 +86,10 @@ int UtcDaliWindowConstructorFromInternalPointerN(void)
 int UtcDaliWindowAssignmentOperatorP(void)
 {
   const Dali::Window window;
-  Dali::Window copy;
-  DALI_TEST_CHECK( ! copy );
+  Dali::Window       copy;
+  DALI_TEST_CHECK(!copy);
   copy = window;
-  DALI_TEST_CHECK( copy == window );
+  DALI_TEST_CHECK(copy == window);
 
   END_TEST;
 }
@@ -103,7 +99,7 @@ int UtcDaliWindowDestructorP(void)
   Dali::Window* window = new Dali::Window();
   delete window;
 
-  DALI_TEST_CHECK( true );
+  DALI_TEST_CHECK(true);
   END_TEST;
 }
 
@@ -113,26 +109,26 @@ int UtcDaliWindowNewN(void)
   try
   {
     PositionSize windowPosition(0, 0, 0, 0);
-    Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
+    Dali::Window window = Dali::Window::New(windowPosition, "test-window", true);
 
-    tet_result( TET_FAIL );
+    tet_result(TET_FAIL);
   }
-  catch ( DaliException& e )
+  catch(DaliException& e)
   {
-    DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
+    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 );
+    Dali::Window window = Dali::Window::New(windowPosition, "test-window", "test-window-class", true);
 
-    tet_result( TET_FAIL );
+    tet_result(TET_FAIL);
   }
-  catch ( DaliException& e )
+  catch(DaliException& e)
   {
-    DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
+    DALI_TEST_ASSERT(e, "Failed to create X window", TEST_LOCATION);
   }
 
   END_TEST;
@@ -144,11 +140,11 @@ int UtcDaliWindowSetClassN(void)
   try
   {
     window.SetClass("window-name", "window-class");
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -160,11 +156,11 @@ int UtcDaliWindowRaiseN(void)
   try
   {
     window.Raise();
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -176,11 +172,11 @@ int UtcDaliWindowLowerN(void)
   try
   {
     window.Lower();
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -192,11 +188,11 @@ int UtcDaliWindowActivateN(void)
   try
   {
     window.Activate();
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -207,12 +203,12 @@ int UtcDaliWindowAddAvailableOrientationN(void)
   Dali::Window window;
   try
   {
-    window.AddAvailableOrientation(Dali::Window::PORTRAIT);
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT);
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -223,12 +219,12 @@ int UtcDaliWindowRemoveAvailableOrientationN(void)
   Dali::Window window;
   try
   {
-    window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    window.RemoveAvailableOrientation(Dali::WindowOrientation::PORTRAIT);
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -239,12 +235,12 @@ int UtcDaliWindowSetPreferredOrientationN(void)
   Dali::Window window;
   try
   {
-    window.SetPreferredOrientation(Dali::Window::PORTRAIT);
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    window.SetPreferredOrientation(Dali::WindowOrientation::PORTRAIT);
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -255,12 +251,12 @@ int UtcDaliWindowGetPreferredOrientationN(void)
   Dali::Window window;
   try
   {
-    Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
-    DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
+    Dali::WindowOrientation orientation = window.GetPreferredOrientation();
+    DALI_TEST_CHECK(orientation == Dali::WindowOrientation::PORTRAIT); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -272,11 +268,11 @@ int UtcDaliWindowGetNativeHandleN(void)
   try
   {
     Dali::Any handle = window.GetNativeHandle();
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -287,12 +283,12 @@ int UtcDaliWindowSetAcceptFocusN(void)
   Dali::Window window;
   try
   {
-    window.SetAcceptFocus( true );
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    window.SetAcceptFocus(true);
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -304,11 +300,11 @@ int UtcDaliWindowIsFocusAcceptableN(void)
   try
   {
     window.IsFocusAcceptable();
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;
@@ -320,28 +316,11 @@ int UtcDaliWindowFocusChangeSignalN(void)
   try
   {
     window.FocusChangeSignal();
-    DALI_TEST_CHECK( false ); // Should not reach here!
-  }
-  catch( ... )
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliWindowPartialUpdate(void)
-{
-  Dali::Window window;
-  try
-  {
-    std::vector<Rect<int>> damagedAreas;
-    DevelWindow::SetDamagedAreas(window, damagedAreas);
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;