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 cb7de36..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>
-
-namespace Dali
-{
-class DragAndDropDetector : public BaseHandle {}; // For UtcDaliWindowGetDragAndDropDetectorN
-}
 
 using namespace Dali;
 
@@ -39,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;
 }
@@ -85,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;
 }
@@ -94,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;
 }
@@ -107,7 +99,7 @@ int UtcDaliWindowDestructorP(void)
   Dali::Window* window = new Dali::Window();
   delete window;
 
-  DALI_TEST_CHECK( true );
+  DALI_TEST_CHECK(true);
   END_TEST;
 }
 
@@ -117,74 +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 );
-
-    tet_result( TET_FAIL );
-  }
-  catch ( DaliException& e )
-  {
-    DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliWindowShowIndicatorN(void)
-{
-  Dali::Window window;
-  try
-  {
-    window.ShowIndicator(Dali::Window::VISIBLE);
-    DALI_TEST_CHECK( false ); // Should not reach here!
-  }
-  catch( ... )
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliWindowSetIndicatorBgOpacityN(void)
-{
-  Dali::Window window;
-  try
-  {
-    window.SetIndicatorBgOpacity(Dali::Window::OPAQUE);
-    DALI_TEST_CHECK( false ); // Should not reach here!
-  }
-  catch( ... )
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
+    Dali::Window window = Dali::Window::New(windowPosition, "test-window", "test-window-class", true);
 
-int UtcDaliWindowRotateIndicatorN(void)
-{
-  Dali::Window window;
-  try
-  {
-    window.RotateIndicator(Dali::Window::PORTRAIT);
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    tet_result(TET_FAIL);
   }
-  catch( ... )
+  catch(DaliException& e)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_ASSERT(e, "Failed to create X window", TEST_LOCATION);
   }
 
   END_TEST;
@@ -196,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;
@@ -212,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;
@@ -228,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;
@@ -244,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;
@@ -259,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;
@@ -275,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;
@@ -291,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;
@@ -307,28 +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!
-  }
-  catch( ... )
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliWindowGetDragAndDropDetectorN(void)
-{
-  Dali::Window window;
-  try
-  {
-    DragAndDropDetector detector = window.GetDragAndDropDetector();
-    DALI_TEST_CHECK( !detector ); // 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;
@@ -340,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;
@@ -355,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;
@@ -372,60 +300,27 @@ int UtcDaliWindowIsFocusAcceptableN(void)
   try
   {
     window.IsFocusAcceptable();
-    DALI_TEST_CHECK( false ); // Should not reach here!
-  }
-  catch( ... )
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliWindowIndicatorVisibilityChangedSignalN(void)
-{
-  Dali::Window window;
-  try
-  {
-    window.IndicatorVisibilityChangedSignal();
-    DALI_TEST_CHECK( false ); // Should not reach here!
-  }
-  catch( ... )
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliWindowFocusChangedSignalN(void)
-{
-  Dali::Window window;
-  try
-  {
-    window.FocusChangedSignal();
-    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;
 }
 
-int UtcDaliWindowPartialUpdate(void)
+int UtcDaliWindowFocusChangeSignalN(void)
 {
   Dali::Window window;
   try
   {
-    std::vector<Rect<int>> damagedAreas;
-    DevelWindow::SetDamagedAreas(window, damagedAreas);
-    DALI_TEST_CHECK( false ); // Should not reach here!
+    window.FocusChangeSignal();
+    DALI_TEST_CHECK(false); // Should not reach here!
   }
-  catch( ... )
+  catch(...)
   {
-    DALI_TEST_CHECK( true );
+    DALI_TEST_CHECK(true);
   }
 
   END_TEST;