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 );
127 int UtcDaliWindowShowIndicatorN(void)
132 window.ShowIndicator(Dali::Window::VISIBLE);
133 DALI_TEST_CHECK( false ); // Should not reach here!
137 DALI_TEST_CHECK( true );
143 int UtcDaliWindowSetIndicatorBgOpacityN(void)
148 window.SetIndicatorBgOpacity(Dali::Window::OPAQUE);
149 DALI_TEST_CHECK( false ); // Should not reach here!
153 DALI_TEST_CHECK( true );
159 int UtcDaliWindowRotateIndicatorN(void)
164 window.RotateIndicator(Dali::Window::PORTRAIT);
165 DALI_TEST_CHECK( false ); // Should not reach here!
169 DALI_TEST_CHECK( true );
175 int UtcDaliWindowSetClassN(void)
180 window.SetClass("window-name", "window-class");
181 DALI_TEST_CHECK( false ); // Should not reach here!
185 DALI_TEST_CHECK( true );
191 int UtcDaliWindowRaiseN(void)
197 DALI_TEST_CHECK( false ); // Should not reach here!
201 DALI_TEST_CHECK( true );
207 int UtcDaliWindowLowerN(void)
213 DALI_TEST_CHECK( false ); // Should not reach here!
217 DALI_TEST_CHECK( true );
223 int UtcDaliWindowActivateN(void)
229 DALI_TEST_CHECK( false ); // Should not reach here!
233 DALI_TEST_CHECK( true );
239 int UtcDaliWindowAddAvailableOrientationN(void)
244 window.AddAvailableOrientation(Dali::Window::PORTRAIT);
245 DALI_TEST_CHECK( false ); // Should not reach here!
249 DALI_TEST_CHECK( true );
255 int UtcDaliWindowRemoveAvailableOrientationN(void)
260 window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
261 DALI_TEST_CHECK( false ); // Should not reach here!
265 DALI_TEST_CHECK( true );
271 int UtcDaliWindowSetPreferredOrientationN(void)
276 window.SetPreferredOrientation(Dali::Window::PORTRAIT);
277 DALI_TEST_CHECK( false ); // Should not reach here!
281 DALI_TEST_CHECK( true );
287 int UtcDaliWindowGetPreferredOrientationN(void)
292 Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
293 DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
297 DALI_TEST_CHECK( true );
303 int UtcDaliWindowGetDragAndDropDetectorN(void)
308 DragAndDropDetector detector = window.GetDragAndDropDetector();
309 DALI_TEST_CHECK( !detector ); // Should not reach here!
313 DALI_TEST_CHECK( true );
319 int UtcDaliWindowGetNativeHandleN(void)
324 Dali::Any handle = window.GetNativeHandle();
325 DALI_TEST_CHECK( false ); // Should not reach here!
329 DALI_TEST_CHECK( true );
335 int UtcDaliWindowIndicatorVisibilityChangedSignalN(void)
340 window.IndicatorVisibilityChangedSignal();
341 DALI_TEST_CHECK( false ); // Should not reach here!
345 DALI_TEST_CHECK( true );