2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Karol Pawlowski (k.pawlowski@samsung.com)
19 * @author Tomasz Iwanek (t.iwanek@samsung.com)
21 * @brief Manifest installation test's bodies
25 #include <dpl/utils/wrt_utility.h>
26 #include <dpl/test/test_runner.h>
27 #include <InstallerWrapper.h>
28 #include <ManifestFile.h>
29 #include <installer_log.h>
30 #include <dpl/wrt-dao-ro/global_config.h>
32 using namespace InstallerWrapper;
34 ////////////////////////////////////////////////////////////////////////////////
36 RUNNER_TEST_GROUP_INIT(Manifest)
39 Name: creatingManifestFile
40 Description: Creation of manifest file by wrt-installer test
41 Expected: file should be created and installed by wrt-installer. Content should
44 RUNNER_TEST(creatingManifestFile)
46 std::string manifestPath = "/opt/share/packages/";
47 /* This widget removal should stay here in case previous test run failed
48 * (so widget has not been uninstalled) */
51 if(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
52 != InstallerWrapper::Success)
55 RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
56 == InstallerWrapper::Success);
59 RUNNER_ASSERT(WrtUtilFileExists(manifestPath.append(tizenId.substr(0,10)).append(".xml")));
60 ManifestFile mf(manifestPath);
64 _D("Package %s", mf.getValueByXpath("/p:manifest/@package").c_str());
65 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@package")
66 == tizenId.substr(0,10));
67 _D("type %s", mf.getValueByXpath("/p:manifest/@type").c_str());
68 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@type")
70 _D("version %s", mf.getValueByXpath("/p:manifest/@version").c_str());
71 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@version")
73 _D("label %s", mf.getValueByXpath("/p:manifest/p:label").c_str());
74 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:label")
75 == "Manifest Example");
77 _D("email %s", mf.getValueByXpath("/p:manifest/p:author/@email").c_str());
78 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@email")
79 == "manifest@misc.test.create.desktop.com");
80 _D("href %s", mf.getValueByXpath("/p:manifest/p:author/@href").c_str());
81 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@href")
82 == "http://misc.test.create.desktop.com");
83 _D("author %s", mf.getValueByXpath("/p:manifest/p:author").c_str());
84 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author")
87 _D("appid %s", mf.getValueByXpath("/p:manifest/p:ui-application/@appid").c_str());
88 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@appid")
90 _D("type %s", mf.getValueByXpath("/p:manifest/p:ui-application/@type").c_str());
91 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@type")
93 _D("extraid %s", mf.getValueByXpath("/p:manifest/p:ui-application/@extraid").c_str());
94 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@extraid")
95 == "http://test.samsung.com/widget/manifestTest");
96 _D("icon %s", mf.getValueByXpath("/p:manifest/p:ui-application/p:icon").c_str());
97 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:icon")
98 == (std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath()) + "/" + tizenId.substr(0,10) + WrtDB::GlobalConfig::GetWidgetSharedPath() + WrtDB::GlobalConfig::GetWidgetResPath() + "/" + tizenId + ".png"));
100 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[not(@xml:lang)]")
101 == "Manifest Example");
102 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='de-de']")
103 == "Manifest Beispiel");
104 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='en-us']")
105 == "Manifest Example");
106 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pl']")
107 == "Przykład Manifest");
108 RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pt-pt']")
109 == "Exemplo manifesto");
111 Catch(ManifestFile::ManifestParseError)
113 RUNNER_ASSERT_MSG(false,DPL::Exception::KnownExceptionToString(_rethrown_exception));
115 /* If test finished sucessfully than uninstall test widget */