Manifest tests - description element 83/60483/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 26 Feb 2016 11:11:05 +0000 (12:11 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Mon, 29 Feb 2016 09:16:08 +0000 (01:16 -0800)
Tests to pass requires:
 - https://review.tizen.org/gerrit/60481
 - https://review.tizen.org/gerrit/60480

Change-Id: Ic843191230b5a804351b4c37130c40dc7f854a04

src/unit_tests/manifest_test.cc
src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Lang_Invalid/tizen-manifest.xml [new file with mode: 0644]
src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Many/tizen-manifest.xml [new file with mode: 0644]
src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Missing/tizen-manifest.xml [new file with mode: 0644]
src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Text_Invalid/tizen-manifest.xml [new file with mode: 0644]
src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Valid/tizen-manifest.xml [new file with mode: 0644]

index 7e7acde0e99d6ac5ae6aefe6be7945382d587c5d..3a283f2afd788c8a6b12250127312a68f7819bbc 100644 (file)
@@ -270,3 +270,49 @@ TEST_F(ManifestTest, AuthorElement_Many) {
   StepParseRunner runner(GetMyName());
   ASSERT_FALSE(runner.Run());
 }
+
+TEST_F(ManifestTest, DescriptionElement_Missing) {
+  StepParseRunner runner(GetMyName());
+  ASSERT_TRUE(runner.Run());
+  manifest_x* m = runner.GetManifest();
+  ASSERT_NE(m, nullptr);
+  auto descriptions = GListRange<description_x*>(m->description);
+  ASSERT_EQ(Size(&descriptions), 0);
+}
+
+TEST_F(ManifestTest, DescriptionElement_Valid) {
+  StepParseRunner runner(GetMyName());
+  ASSERT_TRUE(runner.Run());
+  manifest_x* m = runner.GetManifest();
+  ASSERT_NE(m, nullptr);
+  auto descriptions = GListRange<description_x*>(m->description);
+  ASSERT_EQ(Size(&descriptions), 1);
+  description_x* description = *descriptions.begin();
+  ASSERT_CSTR_EQ(description->text, "text");
+  ASSERT_CSTR_EQ(description->lang, "en-GB");
+}
+
+TEST_F(ManifestTest, DescriptionElement_Many) {
+  StepParseRunner runner(GetMyName());
+  ASSERT_TRUE(runner.Run());
+  manifest_x* m = runner.GetManifest();
+  ASSERT_NE(m, nullptr);
+  auto descriptions = GListRange<description_x*>(m->description);
+  ASSERT_EQ(Size(&descriptions), 2);
+  description_x* description1 = *descriptions.begin();
+  description_x* description2 = *++descriptions.begin();
+  ASSERT_CSTR_EQ(description1->text, "text");
+  ASSERT_CSTR_EQ(description1->lang, "en-GB");
+  ASSERT_CSTR_EQ(description2->text, "text2");
+  ASSERT_CSTR_EQ(description2->lang, DEFAULT_LOCALE);
+}
+
+TEST_F(ManifestTest, DescriptionElement_Text_Invalid) {
+  StepParseRunner runner(GetMyName());
+  ASSERT_FALSE(runner.Run());
+}
+
+TEST_F(ManifestTest, DescriptionElement_Lang_Invalid) {
+  StepParseRunner runner(GetMyName());
+  ASSERT_FALSE(runner.Run());
+}
diff --git a/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Lang_Invalid/tizen-manifest.xml b/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Lang_Invalid/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..dc63a51
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="package0id" version="1.0.0">
+    <ui-application appid="package0id.appid" exec="testapp" type="capp">
+    </ui-application>
+    <description xml:lang="non-existing-locale">text</description>
+</manifest>
diff --git a/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Many/tizen-manifest.xml b/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Many/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..981f0c7
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="package0id" version="1.0.0">
+    <ui-application appid="package0id.appid" exec="testapp" type="capp">
+    </ui-application>
+    <description xml:lang="en-GB">text</description>
+    <description>text2</description>
+</manifest>
diff --git a/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Missing/tizen-manifest.xml b/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Missing/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..f0bba4a
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="package0id" version="1.0.0">
+    <ui-application appid="package0id.appid" exec="testapp" type="capp">
+    </ui-application>
+</manifest>
diff --git a/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Text_Invalid/tizen-manifest.xml b/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Text_Invalid/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..998c058
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="package0id" version="1.0.0">
+    <ui-application appid="package0id.appid" exec="testapp" type="capp">
+    </ui-application>
+    <description xml:lang="en-GB"></description>
+</manifest>
diff --git a/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Valid/tizen-manifest.xml b/src/unit_tests/test_samples/manifest/ManifestTest.DescriptionElement_Valid/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..3d06cd0
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="package0id" version="1.0.0">
+    <ui-application appid="package0id.appid" exec="testapp" type="capp">
+    </ui-application>
+    <description xml:lang="en-GB">text</description>
+</manifest>