/*
- * 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-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>
using namespace Dali;
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;
+ }
+
+ 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;
+ }
+}
-Ecore_X_Screen* ecore_x_default_screen_get(void)
+int UtcDaliWindowConstructorP(void)
{
- screenId += 8;
- return (Ecore_X_Screen*)screenId;
+ Dali::Window window;
+ DALI_TEST_CHECK(!window);
+ END_TEST;
}
-void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
+int UtcDaliWindowCopyConstructorP(void)
{
- *w = 100;
- *h = 100;
+ Dali::Window window;
+ Dali::Window copy(window);
+ DALI_TEST_CHECK(copy == window);
+
+ END_TEST;
}
-Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
+int UtcDaliWindowConstructorFromInternalPointerN(void)
{
- return 0;
+ 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;
}
-int UtcDaliToolkitWindowConstructorP(void)
+int UtcDaliWindowDestructorP(void)
+{
+ Dali::Window* window = new Dali::Window();
+ delete window;
+
+ DALI_TEST_CHECK(true);
+ END_TEST;
+}
+
+int UtcDaliWindowNewN(void)
+{
+ // Attempt to create a new window
+ try
+ {
+ PositionSize windowPosition(0, 0, 0, 0);
+ Dali::Window window = Dali::Window::New(windowPosition, "test-window", true);
+
+ tet_result(TET_FAIL);
+ }
+ catch(DaliException& e)
+ {
+ 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;
- DALI_TEST_CHECK( !window );
+ try
+ {
+ window.SetClass("window-name", "window-class");
+ DALI_TEST_CHECK(false); // Should not reach here!
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
+
END_TEST;
}
-int UtcDaliToolkitWindowCopyConstructorP(void)
+int UtcDaliWindowRaiseN(void)
{
Dali::Window window;
- Dali::Window copy( window );
- DALI_TEST_CHECK( copy == window );
+ try
+ {
+ window.Raise();
+ DALI_TEST_CHECK(false); // Should not reach here!
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
END_TEST;
}
-int UtcDaliToolkitWindowAssignmentOperatorP(void)
+int UtcDaliWindowLowerN(void)
{
Dali::Window window;
- Dali::Window copy = window;
- DALI_TEST_CHECK( copy == window );
+ try
+ {
+ window.Lower();
+ DALI_TEST_CHECK(false); // Should not reach here!
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
END_TEST;
}
-int UtcDaliWindowDestructorP(void)
+int UtcDaliWindowActivateN(void)
{
- Dali::Window* window = new Dali::Window();
- delete window;
+ Dali::Window window;
+ try
+ {
+ window.Activate();
+ DALI_TEST_CHECK(false); // Should not reach here!
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
- DALI_TEST_CHECK( true );
END_TEST;
}
-int UtcDaliWindowNewN(void)
+int UtcDaliWindowAddAvailableOrientationN(void)
{
- // Attempt to create a new window
+ Dali::Window window;
try
{
- PositionSize windowPosition(0, 0, 0, 0);
- Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
+ window.AddAvailableOrientation(Dali::WindowOrientation::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::WindowOrientation::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::WindowOrientation::PORTRAIT);
+ DALI_TEST_CHECK(false); // Should not reach here!
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliWindowGetPreferredOrientationN(void)
+{
+ Dali::Window window;
+ try
+ {
+ Dali::WindowOrientation orientation = window.GetPreferredOrientation();
+ DALI_TEST_CHECK(orientation == Dali::WindowOrientation::PORTRAIT); // Should not reach here!
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
+
+ END_TEST;
+}
- tet_result( TET_FAIL );
+int UtcDaliWindowGetNativeHandleN(void)
+{
+ Dali::Window window;
+ try
+ {
+ Dali::Any handle = window.GetNativeHandle();
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch ( DaliException& e )
+ catch(...)
{
- DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
+ 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;
+}