2 * Copyright (c) 2011 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.
17 * This file contains the declaration of widget dao class.
19 * @file test_suite01.cpp
20 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
25 #include <dpl/log/log.h>
26 #include <dpl/test/test_runner.h>
27 #include <dpl/static_block.h>
28 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
29 #include <dpl/localization/w3c_file_localization.h>
30 #include <LanguageTagsProvider.h>
36 WrtDB::LanguageTagList tags;
37 tags.push_back(L"pl-pl");
38 tags.push_back(L"en-en");
39 tags.push_back(L"pl-en");
40 LanguageTagsProviderSingleton::Instance().setLanguageTags(tags);
43 static const DPL::String widget1Path =
44 L"/opt/share/widget/tests/localization/widget1/";
45 static const DPL::String widget2Path =
46 L"/opt/share/widget/tests/localization/widget2/";
47 } // anonymous namespace
49 RUNNER_TEST(test01_getFilePathInWidgetPackageFromUrl){
50 WrtDB::TizenAppId name = L"tizenid201"; //no difference if it is valid or invalid appId/pkgId, we fill database which has no intergrity constrainst
51 WrtDB::WidgetDAOReadOnly dao(name);
53 DPL::Optional<DPL::String> result = W3CFileLocalization::getFilePathInWidgetPackageFromUrl(
55 DPL::String(L"widget://one"));
57 RUNNER_ASSERT_MSG(!!result, "No result");
60 L"/opt/share/widget/tests/localization/widget1/res/wgt/locales/pl-en/one");
63 RUNNER_TEST(test02_getFilePathInWidgetPackageFromUrl){
64 WrtDB::TizenAppId name = L"tizenid202";
65 WrtDB::WidgetDAOReadOnly dao(name);
67 DPL::Optional<DPL::String> result = W3CFileLocalization::getFilePathInWidgetPackageFromUrl(
69 DPL::String(L"widget://one"));
71 RUNNER_ASSERT_MSG(!!result, "No result");
74 L"/opt/share/widget/tests/localization/widget2/res/wgt/locales/pl-en/one");
77 RUNNER_TEST(test03_getFilePathInWidgetPackageFromUrl){
78 WrtDB::TizenAppId name = L"tizenid202";
79 WrtDB::WidgetDAOReadOnly dao(name);
81 DPL::Optional<DPL::String> result = W3CFileLocalization::getFilePathInWidgetPackageFromUrl(
83 DPL::String(L"widget://two"));
85 RUNNER_ASSERT_MSG(!!result, "No result");
88 L"/opt/share/widget/tests/localization/widget2/res/wgt/locales/en-en/two");
91 RUNNER_TEST(test04_getFilePathInWidgetPackage){
92 WrtDB::TizenAppId name = L"tizenid201";
93 WrtDB::WidgetDAOReadOnly dao(name);
95 DPL::Optional<DPL::String> result = W3CFileLocalization::getFilePathInWidgetPackage(
99 RUNNER_ASSERT_MSG(!!result, "No result");
100 RUNNER_ASSERT(*result == L"locales/pl-en/one");
103 RUNNER_TEST(test05_getFilePathInWidgetPackage){
104 WrtDB::TizenAppId name = L"tizenid202";
105 WrtDB::WidgetDAOReadOnly dao(name);
107 DPL::Optional<DPL::String> result = W3CFileLocalization::getFilePathInWidgetPackage(
109 DPL::String(L"two"));
111 RUNNER_ASSERT_MSG(!!result, "No result");
112 RUNNER_ASSERT(*result == L"locales/en-en/two");