• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RESOURCE_MANAGER_TEST_COMMON_H
17 #define RESOURCE_MANAGER_TEST_COMMON_H
18 
19 #include "hap_resource.h"
20 #include "hap_resource_v1.h"
21 #include "hap_resource_v2.h"
22 #include "hilog_wrapper.h"
23 #include "mmap_file.h"
24 
25 #include <unicode/localebuilder.h>
26 #include <unicode/locid.h>
27 #include <unicode/utypes.h>
28 #include <map>
29 #include <string>
30 #include <vector>
31 
32 namespace OHOS {
33 namespace Global {
34 namespace Resource {
35 // this is relative path
36 static const char *g_resFilePath = "all/assets/entry/resources.index";
37 static const char *g_newResFilePath = "all/assets/entry/resourcesV2.index";
38 static const char *g_hapPath = "all.hap";
39 static const char *g_newModuleHapPath = "newModule.hap";
40 static const char *g_nonExistName = "non_existent_name";
41 static const char *g_overlayResFilePath = "overlay/assets/entry/resources.index";
42 static const char *g_newOverlayResFilePath = "overlay/assets/entry/resourcesV2.index";
43 static const float BASE_DPI = 160.0f;
44 static const int NON_EXIST_ID = 1111;
45 static const char *HAP_PATH_FA = "all_fa.hap";
46 std::string FormatFullPath(const char *fileRelativePath);
47 
48 void PrintIdValues(const std::shared_ptr<IdValues> &idValues);
49 
50 void PrintMapString(const std::map<std::string, std::string> &value);
51 
52 void PrintVectorString(const std::vector<std::string> &value);
53 
54 ResConfig *CreateResConfig(const char *language, const char *script, const char *region);
55 
56 Locale GetLocale(const char *language, const char *script, const char *region);
57 
58 std::shared_ptr<ResConfigImpl> InitDefaultResConfig();
59 } // namespace Resource
60 } // namespace Global
61 } // namespace OHOS
62 #endif
63