Add basic testcase 18/242818/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 1 Sep 2020 05:17:58 +0000 (14:17 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 1 Sep 2020 05:38:42 +0000 (14:38 +0900)
Change-Id: I8bc2b8e4395fb9b5d7f341c04cdd6b99a2488b11
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
CMakeLists.txt
packaging/tpk-manifest-handlers.spec
test/unit_tests/CMakeLists.txt
test/unit_tests/test_samples/tizen-manifest.xml [new file with mode: 0644]
test/unit_tests/test_tpk_manifest_handlers.cc [new file with mode: 0644]

index 31278e43ff65d0f42fb4d77430cdce404675406d..512b79e8298ff9e136de6029cc4574a35c2f8ea7 100644 (file)
@@ -41,6 +41,7 @@ INCLUDE(FindPkgConfig)
 INCLUDE(ApplyPkgConfig)
 
 PKG_CHECK_MODULES(MANIFEST_PARSER_UTILS_DEPS REQUIRED manifest-parser-utils)
+PKG_CHECK_MODULES(MANIFEST_PARSER_DEPS REQUIRED manifest-parser)
 PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock)
 
 FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem)
index e14e2750e75a0295c30609842542e5f2c4e90bd4..66194def34b46a71ef31e763c04bd6b9af09d532 100644 (file)
@@ -62,7 +62,7 @@ find . -name '*.gcno' ! -path './gcov-obj/*' -exec cp '{}' gcov-obj ';'
 %endif
 
 %check
-#export LD_LIBRARY_PATH=../../src/unified
+export LD_LIBRARY_PATH=../../src/tpk_manifest_handlers
 ctest -V
 %if 0%{?gcov:1}
 lcov -c --ignore-errors graph --no-external -q -d . -o tpk-manifest-handlers.info
index 9c9a00a8cb5d47da05c401308bdfc48d2cabee2a..4742a427ec34ea45d1ed752f4fefe295c9180e79 100644 (file)
@@ -13,9 +13,10 @@ TARGET_INCLUDE_DIRECTORIES(${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} PUBLIC
 APPLY_PKG_CONFIG(${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} PUBLIC
   GMOCK_DEPS
   MANIFEST_PARSER_UTILS_DEPS
+  MANIFEST_PARSER_DEPS
 )
 
-#TARGET_LINK_LIBRARIES(${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} PRIVATE ${TARGET_LIBNAME_UNIFIED})
+TARGET_LINK_LIBRARIES(${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} PRIVATE ${TARGET_LIBNAME_TPK_MANIFEST_HANDLERS})
 SET_TARGET_PROPERTIES(${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} PROPERTIES COMPILE_FLAGS "-fPIE")
 SET_TARGET_PROPERTIES(${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} PROPERTIES LINK_FLAGS "-pie")
 
diff --git a/test/unit_tests/test_samples/tizen-manifest.xml b/test/unit_tests/test_samples/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..c91cade
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="4.0" package="org.example.tpk40sample" version="5.0.0">
+    <profile name="mobile"/>
+    <ui-application appid="org.example.tpk40sample.1" exec="tpk40sample" launch_mode="single" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+        <label>tpk40sample-nolocale</label>
+        <label xml:lang="en-us">tpk40-en_us</label>
+        <label xml:lang="ko-kr">tpk40-ko_kr</label>
+        <icon>tpk40sample.png</icon>
+        <icon xml:lang="en-us">tpk40sample-en_us.png</icon>
+        <icon xml:lang="ko-kr">tpk40sample-ko_kr.png</icon>
+    </ui-application>
+    <privileges>
+        <privilege>http://developer.samsung.com/privilege/samsungpass.admin</privilege>
+    </privileges>
+</manifest>
diff --git a/test/unit_tests/test_tpk_manifest_handlers.cc b/test/unit_tests/test_tpk_manifest_handlers.cc
new file mode 100644 (file)
index 0000000..7842f83
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020 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 <gtest/gtest.h>
+
+#include "tpk_manifest_handlers/tpk_config_parser.h"
+
+// If code should uses GMock, this should be changed
+class TpkManifestHandlerTest : public testing::Test {
+ public:
+  TpkManifestHandlerTest() {}
+};
+
+TEST_F(TpkManifestHandlerTest, TpkConfigParser) {
+  std::unique_ptr<tpk::parse::TPKConfigParser> parser;
+  bool ret;
+
+  parser.reset(new tpk::parse::TPKConfigParser());
+  ret = parser->ParseManifest("test_samples/tizen-manifest.xml");
+  EXPECT_TRUE(ret) << "Failed to parse sample manifest";
+}