From: Michal Marszal Date: Mon, 29 Apr 2019 14:37:29 +0000 (+0200) Subject: Unit tests for duplicated splash screen detection X-Git-Tag: accepted/tizen/unified/20190717.115211~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F205151%2F2;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Unit tests for duplicated splash screen detection Patch requires: https://review.tizen.org/gerrit/#/c/205150/ Change-Id: I0c65e0e3e933f3dc1760417192c45ce3c7146acb Signed-off-by: Michal Marszal --- diff --git a/src/unit_tests/manifest_test.cc b/src/unit_tests/manifest_test.cc index b373f50..b44dfb6 100644 --- a/src/unit_tests/manifest_test.cc +++ b/src/unit_tests/manifest_test.cc @@ -28,6 +28,10 @@ manifest_x* StepParseRunner::GetManifest() const { return context_->manifest_data.get(); } +bf::path StepParseRunner::GetRootApplicationPath() const { + return context_->root_application_path.get(); +} + void StepParseRunner::PrepareContext() { context_.reset(new ci::InstallerContext()); context_->root_application_path.set(ci::GetRootAppPath(false, getuid())); diff --git a/src/unit_tests/manifest_test.h b/src/unit_tests/manifest_test.h index 761dd69..8101a58 100644 --- a/src/unit_tests/manifest_test.h +++ b/src/unit_tests/manifest_test.h @@ -43,6 +43,7 @@ class StepParseRunner { bool Run(); manifest_x* GetManifest() const; + boost::filesystem::path GetRootApplicationPath() const; private: void PrepareContext(); diff --git a/src/unit_tests/manifest_test_ui_application.cc b/src/unit_tests/manifest_test_ui_application.cc index da0e9b5..b69d752 100644 --- a/src/unit_tests/manifest_test_ui_application.cc +++ b/src/unit_tests/manifest_test_ui_application.cc @@ -610,3 +610,33 @@ TEST_F(ManifestTest, UIApplicationElement_SetManifestXDefaults) { ASSERT_CSTR_EQ(app->submode, "false"); ASSERT_CSTR_EQ(app->process_pool, "false"); } + +TEST_F(ManifestTest, UIApplicationElement_SplashScreens_Duplicated_Entry) { + StepParseRunner runner(GetMyName()); + ASSERT_TRUE(runner.Run()); + manifest_x* m = runner.GetManifest(); + ASSERT_NE(m, nullptr); + auto apps = GListRange(m->application); + ASSERT_EQ(Size(&apps), 1); + application_x* app = *apps.begin(); + auto splashscreens = GListRange(app->splashscreens); + ASSERT_EQ(splashscreens.Size(), 2); + auto root_path = runner.GetRootApplicationPath(); + std::string pkgid = "package0id"; + auto src_directory = root_path / pkgid / "shared" / "res"; + auto test1 = src_directory / "test1.jpg"; + auto it = splashscreens.begin(); + ASSERT_CSTR_EQ((*it)->src, test1.c_str()); + ASSERT_CSTR_EQ((*it)->type, "img"); + ASSERT_CSTR_EQ((*it)->dpi, "hdpi"); + ASSERT_CSTR_EQ((*it)->orientation, "landscape"); + ASSERT_CSTR_EQ((*it)->operation, + "http://tizen.org/appcontrol/operation/default"); + it++; + ASSERT_CSTR_EQ((*it)->src, test1.c_str()); + ASSERT_CSTR_EQ((*it)->type, "img"); + ASSERT_CSTR_EQ((*it)->dpi, "hdpi"); + ASSERT_CSTR_EQ((*it)->orientation, "landscape"); + ASSERT_CSTR_EQ((*it)->operation, + "http://tizen.org/appcontrol/operation/test_operation"); +} diff --git a/src/unit_tests/test_samples/manifest/ManifestTest.UIApplicationElement_SplashScreens_Duplicated_Entry/tizen-manifest.xml b/src/unit_tests/test_samples/manifest/ManifestTest.UIApplicationElement_SplashScreens_Duplicated_Entry/tizen-manifest.xml new file mode 100644 index 0000000..2bca285 --- /dev/null +++ b/src/unit_tests/test_samples/manifest/ManifestTest.UIApplicationElement_SplashScreens_Duplicated_Entry/tizen-manifest.xml @@ -0,0 +1,10 @@ + + + + + + + + + +