2 * Copyright (c) 2017 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 <devel-api/adaptor-framework/window-devel.h>
22 #include <dali-test-suite-utils.h>
26 void utc_dali_window_startup(void)
28 test_return_value = TET_UNDEF;
31 void utc_dali_window_cleanup(void)
33 test_return_value = TET_PASS;
39 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
41 } // unnamed namespace
46 Ecore_X_Screen* ecore_x_default_screen_get(void)
49 return (Ecore_X_Screen*)screenId;
52 void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
58 Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
65 int UtcDaliWindowConstructorP(void)
68 DALI_TEST_CHECK( !window );
72 int UtcDaliWindowCopyConstructorP(void)
75 Dali::Window copy( window );
76 DALI_TEST_CHECK( copy == window );
81 int UtcDaliWindowConstructorFromInternalPointerN(void)
83 Internal::Adaptor::Window* internalWindow = NULL;
84 Dali::Window window(internalWindow);
85 DALI_TEST_CHECK( !window ); // Should not reach here!
90 int UtcDaliWindowAssignmentOperatorP(void)
92 const Dali::Window window;
94 DALI_TEST_CHECK( ! copy );
96 DALI_TEST_CHECK( copy == window );
101 int UtcDaliWindowDestructorP(void)
103 Dali::Window* window = new Dali::Window();
106 DALI_TEST_CHECK( true );
110 int UtcDaliWindowNewN(void)
112 // Attempt to create a new window
115 PositionSize windowPosition(0, 0, 0, 0);
116 Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
118 tet_result( TET_FAIL );
120 catch ( DaliException& e )
122 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
125 // Attempt to create a new window
128 PositionSize windowPosition(0, 0, 0, 0);
129 Dali::Window window = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
131 tet_result( TET_FAIL );
133 catch ( DaliException& e )
135 DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
141 int UtcDaliWindowShowIndicatorN(void)
146 window.ShowIndicator(Dali::Window::VISIBLE);
147 DALI_TEST_CHECK( false ); // Should not reach here!
151 DALI_TEST_CHECK( true );
157 int UtcDaliWindowSetIndicatorBgOpacityN(void)
162 window.SetIndicatorBgOpacity(Dali::Window::OPAQUE);
163 DALI_TEST_CHECK( false ); // Should not reach here!
167 DALI_TEST_CHECK( true );
173 int UtcDaliWindowRotateIndicatorN(void)
178 window.RotateIndicator(Dali::Window::PORTRAIT);
179 DALI_TEST_CHECK( false ); // Should not reach here!
183 DALI_TEST_CHECK( true );
189 int UtcDaliWindowSetClassN(void)
194 window.SetClass("window-name", "window-class");
195 DALI_TEST_CHECK( false ); // Should not reach here!
199 DALI_TEST_CHECK( true );
205 int UtcDaliWindowRaiseN(void)
211 DALI_TEST_CHECK( false ); // Should not reach here!
215 DALI_TEST_CHECK( true );
221 int UtcDaliWindowLowerN(void)
227 DALI_TEST_CHECK( false ); // Should not reach here!
231 DALI_TEST_CHECK( true );
237 int UtcDaliWindowActivateN(void)
243 DALI_TEST_CHECK( false ); // Should not reach here!
247 DALI_TEST_CHECK( true );
253 int UtcDaliWindowAddAvailableOrientationN(void)
258 window.AddAvailableOrientation(Dali::Window::PORTRAIT);
259 DALI_TEST_CHECK( false ); // Should not reach here!
263 DALI_TEST_CHECK( true );
269 int UtcDaliWindowRemoveAvailableOrientationN(void)
274 window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
275 DALI_TEST_CHECK( false ); // Should not reach here!
279 DALI_TEST_CHECK( true );
285 int UtcDaliWindowSetPreferredOrientationN(void)
290 window.SetPreferredOrientation(Dali::Window::PORTRAIT);
291 DALI_TEST_CHECK( false ); // Should not reach here!
295 DALI_TEST_CHECK( true );
301 int UtcDaliWindowGetPreferredOrientationN(void)
306 Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
307 DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
311 DALI_TEST_CHECK( true );
317 int UtcDaliWindowGetDragAndDropDetectorN(void)
322 DragAndDropDetector detector = window.GetDragAndDropDetector();
323 DALI_TEST_CHECK( !detector ); // Should not reach here!
327 DALI_TEST_CHECK( true );
333 int UtcDaliWindowGetNativeHandleN(void)
338 Dali::Any handle = window.GetNativeHandle();
339 DALI_TEST_CHECK( false ); // Should not reach here!
343 DALI_TEST_CHECK( true );
349 int UtcDaliWindowSetAcceptFocusN(void)
354 DevelWindow::SetAcceptFocus( window, true );
355 DALI_TEST_CHECK( false ); // Should not reach here!
359 DALI_TEST_CHECK( true );
365 int UtcDaliWindowIsFocusAcceptableN(void)
370 DevelWindow::IsFocusAcceptable( window );
371 DALI_TEST_CHECK( false ); // Should not reach here!
375 DALI_TEST_CHECK( true );
381 int UtcDaliWindowIndicatorVisibilityChangedSignalN(void)
386 window.IndicatorVisibilityChangedSignal();
387 DALI_TEST_CHECK( false ); // Should not reach here!
391 DALI_TEST_CHECK( true );
397 int UtcDaliWindowFocusChangedSignalN(void)
402 DevelWindow::FocusChangedSignal( window );
403 DALI_TEST_CHECK( false ); // Should not reach here!
407 DALI_TEST_CHECK( true );