From 6bb38422ae9ba916226dd7befbb8f4ad7c4fd435 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Tue, 17 Jan 2023 11:53:38 +0900 Subject: [PATCH] Add Dali::DevelWindowSystem::GetScreenSize To provide the screen size for csharp bindings by using internal GetScreenSize method, Dali::DevelWindowSystem::GetScreenSize is added. Change-Id: Ib42ace1c4b61f61ae2e506253b5b348a1bd62ca6 --- automated-tests/src/dali-adaptor/CMakeLists.txt | 1 + .../src/dali-adaptor/utc-Dali-WindowSystem.cpp | 50 ++++++++++++++++++++++ .../adaptor-framework/window-system-devel.cpp | 33 ++++++++++++++ .../adaptor-framework/window-system-devel.h | 47 ++++++++++++++++++++ dali/devel-api/file.list | 2 + 5 files changed, 133 insertions(+) create mode 100644 automated-tests/src/dali-adaptor/utc-Dali-WindowSystem.cpp create mode 100644 dali/devel-api/adaptor-framework/window-system-devel.cpp create mode 100644 dali/devel-api/adaptor-framework/window-system-devel.h diff --git a/automated-tests/src/dali-adaptor/CMakeLists.txt b/automated-tests/src/dali-adaptor/CMakeLists.txt index d4fa455..f4c425e 100644 --- a/automated-tests/src/dali-adaptor/CMakeLists.txt +++ b/automated-tests/src/dali-adaptor/CMakeLists.txt @@ -21,6 +21,7 @@ SET(TC_SOURCES utc-Dali-WidgetApplication.cpp utc-Dali-Widget.cpp utc-Dali-Window.cpp + utc-Dali-WindowSystem.cpp ) LIST(APPEND TC_SOURCES diff --git a/automated-tests/src/dali-adaptor/utc-Dali-WindowSystem.cpp b/automated-tests/src/dali-adaptor/utc-Dali-WindowSystem.cpp new file mode 100644 index 0000000..f1e2b23 --- /dev/null +++ b/automated-tests/src/dali-adaptor/utc-Dali-WindowSystem.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include + +using namespace Dali; + +void utc_dali_window_system_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_window_system_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliWindowSystemGetScreenSizeP(void) +{ + try + { + int width, height; + DevelWindowSystem::GetScreenSize(width, height); + + // The width and height refer ecore_x_screen_size_get defined in utc-Dali-Window.cpp. + DALI_TEST_CHECK((width == 100) && (height == 100)); + } + catch(...) + { + DALI_TEST_CHECK(false); + } + + END_TEST; +} \ No newline at end of file diff --git a/dali/devel-api/adaptor-framework/window-system-devel.cpp b/dali/devel-api/adaptor-framework/window-system-devel.cpp new file mode 100644 index 0000000..91dea15 --- /dev/null +++ b/dali/devel-api/adaptor-framework/window-system-devel.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ +namespace DevelWindowSystem +{ +void GetScreenSize(int32_t& width, int32_t& height) +{ + Dali::Internal::Adaptor::WindowSystem::GetScreenSize(width, height); +} + +} // namespace DevelWindowSystem + +} // namespace Dali diff --git a/dali/devel-api/adaptor-framework/window-system-devel.h b/dali/devel-api/adaptor-framework/window-system-devel.h new file mode 100644 index 0000000..fc8dc8f --- /dev/null +++ b/dali/devel-api/adaptor-framework/window-system-devel.h @@ -0,0 +1,47 @@ +#ifndef DALI_WINDOW_SYSTEM_DEVEL_H +#define DALI_WINDOW_SYSTEM_DEVEL_H + +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace DevelWindowSystem +{ + +/** + * @brief Get the screen size. + * + * This function gets the screen size. + * + * @param[out] width The width of the screen + * @param[out] height The height of the screen + */ +DALI_ADAPTOR_API void GetScreenSize(int32_t& width, int32_t& height); + +} // namespace DevelWindowSystem + +} // namespace Dali + +#endif // DALI_WINDOW_SYSTEM_DEVEL_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index c332a7e..9a6bd2f 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -51,6 +51,7 @@ SET( devel_api_src_files ${adaptor_devel_api_dir}/adaptor-framework/offscreen-application.cpp ${adaptor_devel_api_dir}/adaptor-framework/offscreen-window.cpp ${adaptor_devel_api_dir}/adaptor-framework/camera-player.cpp + ${adaptor_devel_api_dir}/adaptor-framework/window-system-devel.cpp ) @@ -110,6 +111,7 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/offscreen-window.h ${adaptor_devel_api_dir}/adaptor-framework/camera-player.h ${adaptor_devel_api_dir}/adaptor-framework/camera-player-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/window-system-devel.h ) -- 2.7.4