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-test-suite-utils.h>
19 #include <dali/dali.h>
20 #include <dali/devel-api/adaptor-framework/window-devel.h>
21 #include <dali/internal/system/linux/dali-ecore-x.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;
37 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
39 } // unnamed namespace
43 Ecore_X_Screen* ecore_x_default_screen_get(void)
46 return (Ecore_X_Screen*)screenId;
49 void ecore_x_screen_size_get(const Ecore_X_Screen* screen, int* w, int* h)
55 Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
61 int UtcDaliWindowConstructorP(void)
64 DALI_TEST_CHECK(!window);
68 int UtcDaliWindowCopyConstructorP(void)
71 Dali::Window copy(window);
72 DALI_TEST_CHECK(copy == window);
77 int UtcDaliWindowConstructorFromInternalPointerN(void)
79 Internal::Adaptor::Window* internalWindow = NULL;
80 Dali::Window window(internalWindow);
81 DALI_TEST_CHECK(!window); // Should not reach here!
86 int UtcDaliWindowAssignmentOperatorP(void)
88 const Dali::Window window;
90 DALI_TEST_CHECK(!copy);
92 DALI_TEST_CHECK(copy == window);
97 int UtcDaliWindowDestructorP(void)
99 Dali::Window* window = new Dali::Window();
102 DALI_TEST_CHECK(true);
106 int UtcDaliWindowNewN(void)
108 // Attempt to create a new window
111 PositionSize windowPosition(0, 0, 0, 0);
112 Dali::Window window = Dali::Window::New(windowPosition, "test-window", true);
114 tet_result(TET_FAIL);
116 catch(DaliException& e)
118 DALI_TEST_ASSERT(e, "Failed to create X window", TEST_LOCATION);
121 // Attempt to create a new window
124 PositionSize windowPosition(0, 0, 0, 0);
125 Dali::Window window = Dali::Window::New(windowPosition, "test-window", "test-window-class", true);
127 tet_result(TET_FAIL);
129 catch(DaliException& e)
131 DALI_TEST_ASSERT(e, "Failed to create X window", TEST_LOCATION);
137 int UtcDaliWindowSetClassN(void)
142 window.SetClass("window-name", "window-class");
143 DALI_TEST_CHECK(false); // Should not reach here!
147 DALI_TEST_CHECK(true);
153 int UtcDaliWindowRaiseN(void)
159 DALI_TEST_CHECK(false); // Should not reach here!
163 DALI_TEST_CHECK(true);
169 int UtcDaliWindowLowerN(void)
175 DALI_TEST_CHECK(false); // Should not reach here!
179 DALI_TEST_CHECK(true);
185 int UtcDaliWindowActivateN(void)
191 DALI_TEST_CHECK(false); // Should not reach here!
195 DALI_TEST_CHECK(true);
201 int UtcDaliWindowAddAvailableOrientationN(void)
206 window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT);
207 DALI_TEST_CHECK(false); // Should not reach here!
211 DALI_TEST_CHECK(true);
217 int UtcDaliWindowRemoveAvailableOrientationN(void)
222 window.RemoveAvailableOrientation(Dali::WindowOrientation::PORTRAIT);
223 DALI_TEST_CHECK(false); // Should not reach here!
227 DALI_TEST_CHECK(true);
233 int UtcDaliWindowSetPreferredOrientationN(void)
238 window.SetPreferredOrientation(Dali::WindowOrientation::PORTRAIT);
239 DALI_TEST_CHECK(false); // Should not reach here!
243 DALI_TEST_CHECK(true);
249 int UtcDaliWindowGetPreferredOrientationN(void)
254 Dali::WindowOrientation orientation = window.GetPreferredOrientation();
255 DALI_TEST_CHECK(orientation == Dali::WindowOrientation::PORTRAIT); // Should not reach here!
259 DALI_TEST_CHECK(true);
265 int UtcDaliWindowGetNativeHandleN(void)
270 Dali::Any handle = window.GetNativeHandle();
271 DALI_TEST_CHECK(false); // Should not reach here!
275 DALI_TEST_CHECK(true);
281 int UtcDaliWindowSetAcceptFocusN(void)
286 window.SetAcceptFocus(true);
287 DALI_TEST_CHECK(false); // Should not reach here!
291 DALI_TEST_CHECK(true);
297 int UtcDaliWindowIsFocusAcceptableN(void)
302 window.IsFocusAcceptable();
303 DALI_TEST_CHECK(false); // Should not reach here!
307 DALI_TEST_CHECK(true);
313 int UtcDaliWindowFocusChangeSignalN(void)
318 window.FocusChangeSignal();
319 DALI_TEST_CHECK(false); // Should not reach here!
323 DALI_TEST_CHECK(true);