Add new tests for output resolution 16/312816/3
authorJunseok Kim <juns.kim@samsung.com>
Fri, 14 Jun 2024 09:06:33 +0000 (18:06 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 17 Jun 2024 00:54:26 +0000 (00:54 +0000)
Change-Id: I0a8b1b9039673d189304b2ea0561b3bde0445813

src/Makefile.am
src/testcase/0021_output_resolution.cpp [new file with mode: 0644]

index 42ce04a9781bb7e16728482e024f088c21f032a9..6c51ce31a326ecb499650dd5b750554ac566e79b 100644 (file)
@@ -29,7 +29,8 @@ testcase/0016_background_state.cpp \
 testcase/0017_input_sync.cpp \
 testcase/0018_input_region.cpp \
 testcase/0019_cnp.cpp \
-testcase/0020_dnd.cpp
+testcase/0020_dnd.cpp \
+testcase/0021_output_resolution.cpp
 
 e_tizen_unittests_SOURCES = \
 e_test_main.cpp \
diff --git a/src/testcase/0021_output_resolution.cpp b/src/testcase/0021_output_resolution.cpp
new file mode 100644 (file)
index 0000000..d7c59c6
--- /dev/null
@@ -0,0 +1,79 @@
+#include <Ecore_Wl2.h>
+
+#include "e_test_event.h"
+#include "e_test_base.h"
+#include "e_test_efl_util.h"
+
+#define CONFIGURED_OUTPUT_RESOLUTION_W 1280
+#define CONFIGURED_OUTPUT_RESOLUTION_H 720
+
+#define BASE_OUTPUT_RESOLUTION_W 640
+#define BASE_OUTPUT_RESOLUTION_H 540
+
+class etTestOutputResolution : public ::etTCBase
+{
+public:
+   etTestOutputResolution() { };
+   ~etTestOutputResolution() { };
+
+protected:
+   std::string testCaseName;
+   std::string testName;
+   etWin *tw_red = NULL;
+
+   void initTC();
+};
+
+void
+etTestOutputResolution::initTC()
+{
+   const ::testing::TestInfo *const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
+
+   testCaseName = test_info->test_case_name();
+   testName = test_info->name();
+}
+
+TEST_F(etTestOutputResolution, basic)
+{
+   int res = 0;
+
+   initTC();
+
+   res = etRunner::get().setConfiguredOutputResolution(CONFIGURED_OUTPUT_RESOLUTION_W, CONFIGURED_OUTPUT_RESOLUTION_H);
+   ASSERT_EQ(res, 1);
+
+   tw_red = initNormalWin("TCWin_Red", 0, 0, 100, 100, E_TC_WIN_COLOR_RED);
+   showTCWin(tw_red);
+   ASSERT_FOCUS_IN(tw_red);
+   ASSERT_TRUE(tw_red != NULL) << "failed to initiation window";
+
+   res = etRunner::get().unsetConfiguredOutputResolution();
+   ASSERT_EQ(res, 0);
+
+   ASSERT_EQ(etRunner::get().verifyTC(testCaseName, testName), EINA_TRUE);
+}
+
+TEST_F(etTestOutputResolution, base_output_resolution_basic)
+{
+   int res = 0;
+
+   initTC();
+
+   res = etRunner::get().setConfiguredOutputResolution(CONFIGURED_OUTPUT_RESOLUTION_W, CONFIGURED_OUTPUT_RESOLUTION_H);
+   ASSERT_EQ(res, 1);
+   res = etRunner::get().setBaseOutputResolution(getpid(), BASE_OUTPUT_RESOLUTION_W, BASE_OUTPUT_RESOLUTION_H);
+   ASSERT_EQ(res, 1);
+
+   tw_red = initNormalWin("TCWin_Red", 0, 0, 100, 100, E_TC_WIN_COLOR_RED);
+   showTCWin(tw_red);
+   ASSERT_FOCUS_IN(tw_red);
+   ASSERT_TRUE(tw_red != NULL) << "failed to initiation window";
+
+   res = etRunner::get().unsetBaseOutputResolution(getpid());
+   ASSERT_EQ(res, 0);
+
+   res = etRunner::get().unsetConfiguredOutputResolution();
+   ASSERT_EQ(res, 0);
+
+   ASSERT_EQ(etRunner::get().verifyTC(testCaseName, testName), EINA_TRUE);
+}
\ No newline at end of file