2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/dali.h>
20 #include <dali-test-suite-utils.h>
24 class DragAndDropDetector : public BaseHandle {}; // For UtcDaliWindowGetDragAndDropDetectorN
29 void utc_dali_window_startup(void)
31 test_return_value = TET_UNDEF;
34 void utc_dali_window_cleanup(void)
36 test_return_value = TET_PASS;
42 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
44 } // unnamed namespace
49 Ecore_X_Screen* ecore_x_default_screen_get(void)
52 return (Ecore_X_Screen*)screenId;
55 void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
61 Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
68 int UtcDaliWindowConstructorP(void)
71 DALI_TEST_CHECK( !window );
75 int UtcDaliWindowCopyConstructorP(void)
78 Dali::Window copy( window );
79 DALI_TEST_CHECK( copy == window );
84 int UtcDaliWindowConstructorFromInternalPointerN(void)
86 Internal::Adaptor::Window* internalWindow = NULL;
87 Dali::Window window(internalWindow);
88 DALI_TEST_CHECK( !window ); // Should not reach here!
93 int UtcDaliWindowAssignmentOperatorP(void)
95 const Dali::Window window;
97 DALI_TEST_CHECK( ! copy );
99 DALI_TEST_CHECK( copy == window );
104 int UtcDaliWindowDestructorP(void)
106 Dali::Window* window = new Dali::Window();
109 DALI_TEST_CHECK( true );
113 int UtcDaliWindowNewN(void)
115 // Attempt to create a new window
118 PositionSize windowPosition(0, 0, 0, 0);
119 Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
121 tet_result( TET_FAIL );
123 catch ( DaliException& e )
125 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
128 // Attempt to create a new window
131 PositionSize windowPosition(0, 0, 0, 0);
132 Dali::Window window = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
134 tet_result( TET_FAIL );
136 catch ( DaliException& e )
138 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
144 int UtcDaliWindowShowIndicatorN(void)
149 window.ShowIndicator(Dali::Window::VISIBLE);
150 DALI_TEST_CHECK( false ); // Should not reach here!
154 DALI_TEST_CHECK( true );
160 int UtcDaliWindowSetIndicatorBgOpacityN(void)
165 window.SetIndicatorBgOpacity(Dali::Window::OPAQUE);
166 DALI_TEST_CHECK( false ); // Should not reach here!
170 DALI_TEST_CHECK( true );
176 int UtcDaliWindowRotateIndicatorN(void)
181 window.RotateIndicator(Dali::Window::PORTRAIT);
182 DALI_TEST_CHECK( false ); // Should not reach here!
186 DALI_TEST_CHECK( true );
192 int UtcDaliWindowSetClassN(void)
197 window.SetClass("window-name", "window-class");
198 DALI_TEST_CHECK( false ); // Should not reach here!
202 DALI_TEST_CHECK( true );
208 int UtcDaliWindowRaiseN(void)
214 DALI_TEST_CHECK( false ); // Should not reach here!
218 DALI_TEST_CHECK( true );
224 int UtcDaliWindowLowerN(void)
230 DALI_TEST_CHECK( false ); // Should not reach here!
234 DALI_TEST_CHECK( true );
240 int UtcDaliWindowActivateN(void)
246 DALI_TEST_CHECK( false ); // Should not reach here!
250 DALI_TEST_CHECK( true );
256 int UtcDaliWindowAddAvailableOrientationN(void)
261 window.AddAvailableOrientation(Dali::Window::PORTRAIT);
262 DALI_TEST_CHECK( false ); // Should not reach here!
266 DALI_TEST_CHECK( true );
272 int UtcDaliWindowRemoveAvailableOrientationN(void)
277 window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
278 DALI_TEST_CHECK( false ); // Should not reach here!
282 DALI_TEST_CHECK( true );
288 int UtcDaliWindowSetPreferredOrientationN(void)
293 window.SetPreferredOrientation(Dali::Window::PORTRAIT);
294 DALI_TEST_CHECK( false ); // Should not reach here!
298 DALI_TEST_CHECK( true );
304 int UtcDaliWindowGetPreferredOrientationN(void)
309 Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
310 DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
314 DALI_TEST_CHECK( true );
320 int UtcDaliWindowGetDragAndDropDetectorN(void)
325 DragAndDropDetector detector = window.GetDragAndDropDetector();
326 DALI_TEST_CHECK( !detector ); // Should not reach here!
330 DALI_TEST_CHECK( true );
336 int UtcDaliWindowGetNativeHandleN(void)
341 Dali::Any handle = window.GetNativeHandle();
342 DALI_TEST_CHECK( false ); // Should not reach here!
346 DALI_TEST_CHECK( true );
352 int UtcDaliWindowSetAcceptFocusN(void)
357 window.SetAcceptFocus( true );
358 DALI_TEST_CHECK( false ); // Should not reach here!
362 DALI_TEST_CHECK( true );
368 int UtcDaliWindowIsFocusAcceptableN(void)
373 window.IsFocusAcceptable();
374 DALI_TEST_CHECK( false ); // Should not reach here!
378 DALI_TEST_CHECK( true );
384 int UtcDaliWindowIndicatorVisibilityChangedSignalN(void)
389 window.IndicatorVisibilityChangedSignal();
390 DALI_TEST_CHECK( false ); // Should not reach here!
394 DALI_TEST_CHECK( true );
400 int UtcDaliWindowFocusChangedSignalN(void)
405 window.FocusChangedSignal();
406 DALI_TEST_CHECK( false ); // Should not reach here!
410 DALI_TEST_CHECK( true );