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 class Internal::Adaptor::Window;
40 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
42 } // unnamed namespace
47 Ecore_X_Screen* ecore_x_default_screen_get(void)
50 return (Ecore_X_Screen*)screenId;
53 void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
59 Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
66 int UtcDaliWindowConstructorP(void)
69 DALI_TEST_CHECK( !window );
73 int UtcDaliWindowCopyConstructorP(void)
76 Dali::Window copy( window );
77 DALI_TEST_CHECK( copy == window );
82 int UtcDaliWindowConstructorFromInternalPointerN(void)
84 Internal::Adaptor::Window* internalWindow = NULL;
85 Dali::Window window(internalWindow);
86 DALI_TEST_CHECK( !window ); // Should not reach here!
91 int UtcDaliWindowAssignmentOperatorP(void)
93 const Dali::Window window;
95 DALI_TEST_CHECK( ! copy );
97 DALI_TEST_CHECK( copy == window );
102 int UtcDaliWindowDestructorP(void)
104 Dali::Window* window = new Dali::Window();
107 DALI_TEST_CHECK( true );
111 int UtcDaliWindowNewN(void)
113 // Attempt to create a new window
116 PositionSize windowPosition(0, 0, 0, 0);
117 Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
119 tet_result( TET_FAIL );
121 catch ( DaliException& e )
123 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
129 int UtcDaliWindowShowIndicatorN(void)
134 window.ShowIndicator(Dali::Window::VISIBLE);
135 DALI_TEST_CHECK( false ); // Should not reach here!
139 DALI_TEST_CHECK( true );
145 int UtcDaliWindowSetIndicatorBgOpacityN(void)
150 window.SetIndicatorBgOpacity(Dali::Window::OPAQUE);
151 DALI_TEST_CHECK( false ); // Should not reach here!
155 DALI_TEST_CHECK( true );
161 int UtcDaliWindowRotateIndicatorN(void)
166 window.RotateIndicator(Dali::Window::PORTRAIT);
167 DALI_TEST_CHECK( false ); // Should not reach here!
171 DALI_TEST_CHECK( true );
177 int UtcDaliWindowSetClassN(void)
182 window.SetClass("window-name", "window-class");
183 DALI_TEST_CHECK( false ); // Should not reach here!
187 DALI_TEST_CHECK( true );
193 int UtcDaliWindowRaiseN(void)
199 DALI_TEST_CHECK( false ); // Should not reach here!
203 DALI_TEST_CHECK( true );
209 int UtcDaliWindowLowerN(void)
215 DALI_TEST_CHECK( false ); // Should not reach here!
219 DALI_TEST_CHECK( true );
225 int UtcDaliWindowActivateN(void)
231 DALI_TEST_CHECK( false ); // Should not reach here!
235 DALI_TEST_CHECK( true );
241 int UtcDaliWindowAddAvailableOrientationN(void)
246 window.AddAvailableOrientation(Dali::Window::PORTRAIT);
247 DALI_TEST_CHECK( false ); // Should not reach here!
251 DALI_TEST_CHECK( true );
257 int UtcDaliWindowRemoveAvailableOrientationN(void)
262 window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
263 DALI_TEST_CHECK( false ); // Should not reach here!
267 DALI_TEST_CHECK( true );
273 int UtcDaliWindowSetPreferredOrientationN(void)
278 window.SetPreferredOrientation(Dali::Window::PORTRAIT);
279 DALI_TEST_CHECK( false ); // Should not reach here!
283 DALI_TEST_CHECK( true );
289 int UtcDaliWindowGetPreferredOrientationN(void)
294 Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
295 DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
299 DALI_TEST_CHECK( true );
305 int UtcDaliWindowGetDragAndDropDetectorN(void)
310 DragAndDropDetector detector = window.GetDragAndDropDetector();
311 DALI_TEST_CHECK( !detector ); // Should not reach here!
315 DALI_TEST_CHECK( true );
321 int UtcDaliWindowGetNativeHandleN(void)
326 Dali::Any handle = window.GetNativeHandle();
327 DALI_TEST_CHECK( false ); // Should not reach here!
331 DALI_TEST_CHECK( true );
337 int UtcDaliWindowIndicatorVisibilityChangedSignalN(void)
342 window.IndicatorVisibilityChangedSignal();
343 DALI_TEST_CHECK( false ); // Should not reach here!
347 DALI_TEST_CHECK( true );