Unit tests for duplicated splash screen detection 51/205151/2
authorMichal Marszal <m.marszal@samsung.com>
Mon, 29 Apr 2019 14:37:29 +0000 (16:37 +0200)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 26 Jun 2019 09:04:54 +0000 (09:04 +0000)
Patch requires: https://review.tizen.org/gerrit/#/c/205150/

Change-Id: I0c65e0e3e933f3dc1760417192c45ce3c7146acb
Signed-off-by: Michal Marszal <m.marszal@samsung.com>
src/unit_tests/manifest_test.cc
src/unit_tests/manifest_test.h
src/unit_tests/manifest_test_ui_application.cc
src/unit_tests/test_samples/manifest/ManifestTest.UIApplicationElement_SplashScreens_Duplicated_Entry/tizen-manifest.xml [new file with mode: 0644]

index b373f50..b44dfb6 100644 (file)
@@ -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()));
index 761dd69..8101a58 100644 (file)
@@ -43,6 +43,7 @@ class StepParseRunner {
 
   bool Run();
   manifest_x* GetManifest() const;
+  boost::filesystem::path GetRootApplicationPath() const;
 
  private:
   void PrepareContext();
index da0e9b5..b69d752 100644 (file)
@@ -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<application_x*>(m->application);
+  ASSERT_EQ(Size(&apps), 1);
+  application_x* app = *apps.begin();
+  auto splashscreens = GListRange<splashscreen_x*>(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 (file)
index 0000000..2bca285
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5.5" package="package0id" version="1.0.0">
+    <ui-application appid="package0id.appid" exec="testapp" type="capp">
+        <splash-screens>
+          <splash-screen src="test1.jpg" type="img" dpi="hdpi" orientation="landscape" app-control-operation="http://tizen.org/appcontrol/operation/default" />
+          <splash-screen src="test1.jpg" type="img" dpi="hdpi" orientation="landscape" app-control-operation="http://tizen.org/appcontrol/operation/default" />
+          <splash-screen src="test1.jpg" type="img" dpi="hdpi" orientation="landscape" app-control-operation="http://tizen.org/appcontrol/operation/test_operation" />
+        </splash-screens>
+    </ui-application>
+</manifest>