2 * Copyright (c) 2020 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>
19 #include <dali/devel-api/adaptor-framework/window-devel.h>
20 #include <dali/internal/system/linux/dali-ecore-x.h>
21 #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 UtcDaliWindowSetClassN(void)
146 window.SetClass("window-name", "window-class");
147 DALI_TEST_CHECK( false ); // Should not reach here!
151 DALI_TEST_CHECK( true );
157 int UtcDaliWindowRaiseN(void)
163 DALI_TEST_CHECK( false ); // Should not reach here!
167 DALI_TEST_CHECK( true );
173 int UtcDaliWindowLowerN(void)
179 DALI_TEST_CHECK( false ); // Should not reach here!
183 DALI_TEST_CHECK( true );
189 int UtcDaliWindowActivateN(void)
195 DALI_TEST_CHECK( false ); // Should not reach here!
199 DALI_TEST_CHECK( true );
205 int UtcDaliWindowAddAvailableOrientationN(void)
210 window.AddAvailableOrientation(Dali::Window::PORTRAIT);
211 DALI_TEST_CHECK( false ); // Should not reach here!
215 DALI_TEST_CHECK( true );
221 int UtcDaliWindowRemoveAvailableOrientationN(void)
226 window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
227 DALI_TEST_CHECK( false ); // Should not reach here!
231 DALI_TEST_CHECK( true );
237 int UtcDaliWindowSetPreferredOrientationN(void)
242 window.SetPreferredOrientation(Dali::Window::PORTRAIT);
243 DALI_TEST_CHECK( false ); // Should not reach here!
247 DALI_TEST_CHECK( true );
253 int UtcDaliWindowGetPreferredOrientationN(void)
258 Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
259 DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
263 DALI_TEST_CHECK( true );
269 int UtcDaliWindowGetNativeHandleN(void)
274 Dali::Any handle = window.GetNativeHandle();
275 DALI_TEST_CHECK( false ); // Should not reach here!
279 DALI_TEST_CHECK( true );
285 int UtcDaliWindowSetAcceptFocusN(void)
290 window.SetAcceptFocus( true );
291 DALI_TEST_CHECK( false ); // Should not reach here!
295 DALI_TEST_CHECK( true );
301 int UtcDaliWindowIsFocusAcceptableN(void)
306 window.IsFocusAcceptable();
307 DALI_TEST_CHECK( false ); // Should not reach here!
311 DALI_TEST_CHECK( true );
317 int UtcDaliWindowFocusChangeSignalN(void)
322 window.FocusChangeSignal();
323 DALI_TEST_CHECK( false ); // Should not reach here!
327 DALI_TEST_CHECK( true );
333 int UtcDaliWindowPartialUpdate(void)
338 std::vector<Rect<int>> damagedAreas;
339 DevelWindow::SetDamagedAreas(window, damagedAreas);
340 DALI_TEST_CHECK( false ); // Should not reach here!
344 DALI_TEST_CHECK( true );