Add Dali::DevelWindowSystem::GetScreenSize 38/286938/3
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Tue, 17 Jan 2023 02:53:38 +0000 (11:53 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 19 Jan 2023 07:10:47 +0000 (16:10 +0900)
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
automated-tests/src/dali-adaptor/utc-Dali-WindowSystem.cpp [new file with mode: 0644]
dali/devel-api/adaptor-framework/window-system-devel.cpp [new file with mode: 0644]
dali/devel-api/adaptor-framework/window-system-devel.h [new file with mode: 0644]
dali/devel-api/file.list

index d4fa455..f4c425e 100644 (file)
@@ -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 (file)
index 0000000..f1e2b23
--- /dev/null
@@ -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 <dali-test-suite-utils.h>
+#include <dali/dali.h>
+#include <dali/devel-api/adaptor-framework/window-system-devel.h>
+
+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 (file)
index 0000000..91dea15
--- /dev/null
@@ -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 <dali/devel-api/adaptor-framework/window-system-devel.h>
+#include <dali/internal/window-system/common/window-system.h>
+
+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 (file)
index 0000000..fc8dc8f
--- /dev/null
@@ -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 <cstdint>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
+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
index c332a7e..9a6bd2f 100755 (executable)
@@ -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
 )