2 * Copyright (c) 2014 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 <devel-api/adaptor-framework/drag-and-drop-detector.h>
21 #include <dali-test-suite-utils.h>
25 void utc_dali_window_startup(void)
27 test_return_value = TET_UNDEF;
30 void utc_dali_window_cleanup(void)
32 test_return_value = TET_PASS;
38 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
40 } // unnamed namespace
45 Ecore_X_Screen* ecore_x_default_screen_get(void)
48 return (Ecore_X_Screen*)screenId;
51 void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
57 Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
64 int UtcDaliWindowConstructorP(void)
67 DALI_TEST_CHECK( !window );
71 int UtcDaliWindowCopyConstructorP(void)
74 Dali::Window copy( window );
75 DALI_TEST_CHECK( copy == window );
80 int UtcDaliWindowConstructorFromInternalPointerN(void)
82 Internal::Adaptor::Window* internalWindow = NULL;
83 Dali::Window window(internalWindow);
84 DALI_TEST_CHECK( !window ); // Should not reach here!
89 int UtcDaliWindowAssignmentOperatorP(void)
91 const Dali::Window window;
93 DALI_TEST_CHECK( ! copy );
95 DALI_TEST_CHECK( copy == window );
100 int UtcDaliWindowDestructorP(void)
102 Dali::Window* window = new Dali::Window();
105 DALI_TEST_CHECK( true );
109 int UtcDaliWindowNewN(void)
111 // Attempt to create a new window
114 PositionSize windowPosition(0, 0, 0, 0);
115 Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
117 tet_result( TET_FAIL );
119 catch ( DaliException& e )
121 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
124 // Attempt to create a new window
127 PositionSize windowPosition(0, 0, 0, 0);
128 Dali::Window window = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
130 tet_result( TET_FAIL );
132 catch ( DaliException& e )
134 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
140 int UtcDaliWindowShowIndicatorN(void)
145 window.ShowIndicator(Dali::Window::VISIBLE);
146 DALI_TEST_CHECK( false ); // Should not reach here!
150 DALI_TEST_CHECK( true );
156 int UtcDaliWindowSetIndicatorBgOpacityN(void)
161 window.SetIndicatorBgOpacity(Dali::Window::OPAQUE);
162 DALI_TEST_CHECK( false ); // Should not reach here!
166 DALI_TEST_CHECK( true );
172 int UtcDaliWindowRotateIndicatorN(void)
177 window.RotateIndicator(Dali::Window::PORTRAIT);
178 DALI_TEST_CHECK( false ); // Should not reach here!
182 DALI_TEST_CHECK( true );
188 int UtcDaliWindowSetClassN(void)
193 window.SetClass("window-name", "window-class");
194 DALI_TEST_CHECK( false ); // Should not reach here!
198 DALI_TEST_CHECK( true );
204 int UtcDaliWindowRaiseN(void)
210 DALI_TEST_CHECK( false ); // Should not reach here!
214 DALI_TEST_CHECK( true );
220 int UtcDaliWindowLowerN(void)
226 DALI_TEST_CHECK( false ); // Should not reach here!
230 DALI_TEST_CHECK( true );
236 int UtcDaliWindowActivateN(void)
242 DALI_TEST_CHECK( false ); // Should not reach here!
246 DALI_TEST_CHECK( true );
252 int UtcDaliWindowAddAvailableOrientationN(void)
257 window.AddAvailableOrientation(Dali::Window::PORTRAIT);
258 DALI_TEST_CHECK( false ); // Should not reach here!
262 DALI_TEST_CHECK( true );
268 int UtcDaliWindowRemoveAvailableOrientationN(void)
273 window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
274 DALI_TEST_CHECK( false ); // Should not reach here!
278 DALI_TEST_CHECK( true );
284 int UtcDaliWindowSetPreferredOrientationN(void)
289 window.SetPreferredOrientation(Dali::Window::PORTRAIT);
290 DALI_TEST_CHECK( false ); // Should not reach here!
294 DALI_TEST_CHECK( true );
300 int UtcDaliWindowGetPreferredOrientationN(void)
305 Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
306 DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
310 DALI_TEST_CHECK( true );
316 int UtcDaliWindowGetDragAndDropDetectorN(void)
321 DragAndDropDetector detector = window.GetDragAndDropDetector();
322 DALI_TEST_CHECK( !detector ); // Should not reach here!
326 DALI_TEST_CHECK( true );
332 int UtcDaliWindowGetNativeHandleN(void)
337 Dali::Any handle = window.GetNativeHandle();
338 DALI_TEST_CHECK( false ); // Should not reach here!
342 DALI_TEST_CHECK( true );
348 int UtcDaliWindowIndicatorVisibilityChangedSignalN(void)
353 window.IndicatorVisibilityChangedSignal();
354 DALI_TEST_CHECK( false ); // Should not reach here!
358 DALI_TEST_CHECK( true );