• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "resource_manager_test_media.h"
17 
18 #include "resource_manager_test_common.h"
19 
20 using namespace OHOS::Global::Resource;
21 using namespace testing::ext;
22 namespace {
23 class ResourceManagerTestString : public testing::Test {
24 public:
25     static void SetUpTestCase(void);
26 
27     static void TearDownTestCase(void);
28 
29     void SetUp();
30 
31     void TearDown();
32 
ResourceManagerTestString()33     ResourceManagerTestString() : rm(nullptr)
34     {}
35 
~ResourceManagerTestString()36     ~ResourceManagerTestString()
37     {}
38 public:
39     ResourceManager *rm;
40     ResourceManagerTestCommon *rmc;
41 };
42 
SetUpTestCase(void)43 void ResourceManagerTestString::SetUpTestCase(void)
44 {
45     // step 1: input testsuit setup step
46     g_logLevel = LOG_DEBUG;
47 }
48 
TearDownTestCase(void)49 void ResourceManagerTestString::TearDownTestCase(void)
50 {
51     // step 2: input testsuit teardown step
52 }
53 
SetUp(void)54 void ResourceManagerTestString::SetUp(void)
55 {
56     this->rm = CreateResourceManager();
57     this->rmc = new ResourceManagerTestCommon(rm);
58 }
59 
TearDown(void)60 void ResourceManagerTestString::TearDown(void)
61 {
62     delete this->rm;
63     delete this->rmc;
64 }
65 
66 /*
67  * @tc.name: ResourceManagerGetStringByIdTest001
68  * @tc.desc: Test GetStringById function
69  * @tc.type: FUNC
70  */
71 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByIdTest001, TestSize.Level1)
72 {
73     rmc->AddResource("en", nullptr, nullptr);
74 
75     rmc->TestStringById("app_name", "App Name");
76 
77     rmc->TestStringById("copyright_text", "XXXXXX All rights reserved. ©2011-2019");
78 
79     rmc->TestStringById("string_ref", "XXXXXX All rights reserved. ©2011-2019");
80 
81     rmc->TestStringById("string_ref2", "XXXXXX All rights reserved. ©2011-2019");
82 }
83 
84 /*
85  * @tc.name: ResourceManagerGetStringByIdTest002
86  * @tc.desc: Test GetStringById function
87  * @tc.type: FUNC
88  */
89 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByIdTest002, TestSize.Level1)
90 {
91     rmc->AddResource("zh", nullptr, nullptr);
92 
93     rmc->TestStringById("app_name", "应用名称");
94 
95     rmc->TestStringById("copyright_text", "版权所有 ©2011-2019 XXXX有限公司保留一切权利");
96 
97     rmc->TestStringById("string_ref", "$aaaaa");
98 
99     rmc->TestStringById("string_ref2", "$aaaaa");
100 }
101 
102 /*
103  * @tc.name: ResourceManagerGetStringByIdTest003
104  * @tc.desc: Test GetStringById function
105  * @tc.type: FUNC
106  */
107 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByIdTest003, TestSize.Level1)
108 {
109     rmc->AddResource("zh", nullptr, nullptr);
110 
111     std::string outValue;
112     RState state = rm->GetStringById(NON_EXIST_ID, outValue);
113     ASSERT_EQ(ERROR_CODE_RES_ID_NOT_FOUND, state);
114 }
115 
116 /*
117  * @tc.name: ResourceManagerGetStringByIdTest004
118  * @tc.desc: Test GetStringById function
119  * @tc.type: FUNC
120  */
121 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByIdTest004, TestSize.Level1)
122 {
123     rmc->AddResource("en", nullptr, nullptr);
124 
125     std::vector<std::string> overlayPaths;
126     overlayPaths.push_back(FormatFullPath(g_overlayResFilePath).c_str());
127     bool ret = ((ResourceManagerImpl*)rm)->AddResource(FormatFullPath(g_resFilePath).c_str(), overlayPaths);
128     ASSERT_TRUE(ret);
129     rmc->TestStringById("ohos_app_name", "SystemOverlay");
130 }
131 
132 /*
133  * @tc.name: ResourceManagerGetStringByIdTest005
134  * @tc.desc: Test GetStringById function
135  * @tc.type: FUNC
136  */
137 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByIdTest005, TestSize.Level1)
138 {
139     rmc->AddResource("zh", nullptr, nullptr);
140 
141     std::vector<std::string> overlayPaths;
142     overlayPaths.push_back(FormatFullPath(g_overlayResFilePath).c_str());
143     bool ret = ((ResourceManagerImpl*)rm)->AddResource(FormatFullPath(g_resFilePath).c_str(), overlayPaths);
144     ASSERT_TRUE(ret);
145     rmc->TestStringById("ohos_lab_answer_call", "overlay接听电话");
146 }
147 
148 /*
149  * @tc.name: ResourceManagerGetStringByNameTest001
150  * @tc.desc: Test GetStringByName function
151  * @tc.type: FUNC
152  */
153 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameTest001, TestSize.Level1)
154 {
155     rmc->AddResource("en", nullptr, nullptr);
156 
157     rmc->TestStringByName("app_name", "App Name");
158 
159     rmc->TestStringByName("copyright_text", "XXXXXX All rights reserved. ©2011-2019");
160 
161     rmc->TestStringByName("string_ref", "XXXXXX All rights reserved. ©2011-2019");
162 
163     rmc->TestStringByName("string_ref2", "XXXXXX All rights reserved. ©2011-2019");
164 }
165 
166 /*
167  * @tc.name: ResourceManagerGetStringByNameTest002
168  * @tc.desc: Test GetStringByName function
169  * @tc.type: FUNC
170  */
171 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameTest002, TestSize.Level1)
172 {
173     rmc->AddResource("zh", nullptr, nullptr);
174 
175     rmc->TestStringByName("app_name", "应用名称");
176 
177     rmc->TestStringByName("copyright_text", "版权所有 ©2011-2019 XXXX有限公司保留一切权利");
178 
179     rmc->TestStringByName("string_ref", "$aaaaa");
180 
181     rmc->TestStringByName("string_ref2", "$aaaaa");
182 }
183 
184 /*
185  * @tc.name: ResourceManagerGetStringByNameTest003
186  * @tc.desc: Test GetStringByName function
187  * @tc.type: FUNC
188  */
189 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameTest003, TestSize.Level1)
190 {
191     rmc->AddResource("zh", nullptr, nullptr);
192 
193     std::string outValue;
194     RState state = rm->GetStringByName(g_nonExistName, outValue);
195     ASSERT_EQ(ERROR_CODE_RES_NAME_NOT_FOUND, state);
196 }
197 
198 /*
199  * @tc.name: ResourceManagerGetStringByNameTest004
200  * @tc.desc: Test GetStringByName function
201  * @tc.type: FUNC
202  */
203 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameTest004, TestSize.Level1)
204 {
205     auto rc = CreateResConfig();
206     if (rc == nullptr) {
207         EXPECT_TRUE(false);
208         return;
209     }
210     rc->SetLocaleInfo("zh", nullptr, "CN");
211     rc->SetDirection(DIRECTION_VERTICAL);
212     rm->UpdateResConfig(*rc);
213     delete rc;
214     std::vector<std::string> overlayPaths;
215     overlayPaths.push_back(FormatFullPath(g_overlayResFilePath).c_str());
216     bool ret = ((ResourceManagerImpl *)rm)->AddResource(FormatFullPath(g_resFilePath).c_str(), overlayPaths);
217     ASSERT_TRUE(ret);
218     std::string outValue;
219     ((ResourceManagerImpl *)rm)->GetStringByName("ohos_desc_camera", outValue);
220     ASSERT_EQ(outValue, "允许应用拍摄照片和视频。");
221 }
222 
223 /*
224  * @tc.name: ResourceManagerGetStringByNameTest005
225  * @tc.desc: Test GetStringByName function
226  * @tc.type: FUNC
227  */
228 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameTest005, TestSize.Level1)
229 {
230     rmc->AddResource("en", nullptr, nullptr);
231     std::vector<std::string> overlayPaths;
232     overlayPaths.push_back(FormatFullPath(g_overlayResFilePath).c_str());
233     bool ret = ((ResourceManagerImpl *)rm)->AddResource(FormatFullPath(g_resFilePath).c_str(), overlayPaths);
234     ASSERT_TRUE(ret);
235     std::string outValue;
236     ((ResourceManagerImpl *)rm)->GetStringByName("hello", outValue);
237     ASSERT_EQ(outValue, "Helloooo");
238 }
239 
240 /*
241  * @tc.name: ResourceManagerGetStringFormatByIdTest001
242  * @tc.desc: Test GetStringFormatById function
243  * @tc.type: FUNC
244  */
245 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest001, TestSize.Level1)
246 {
247     rmc->AddResource("zh", nullptr, nullptr);
248 
249     const char *name = "app_name";
250     int id = rmc->GetResId(name, ResType::STRING);
251     ASSERT_TRUE(id > 0);
252     std::string outValue;
253     RState state = rm->GetStringFormatById(outValue, id, 101);
254     ASSERT_EQ(SUCCESS, state);
255     ASSERT_EQ("应用名称", outValue);
256 }
257 
258 /*
259  * @tc.name: ResourceManagerGetStringFormatByIdTest002
260  * @tc.desc: Test GetStringFormatById function
261  * @tc.type: FUNC
262  */
263 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest002, TestSize.Level1)
264 {
265     rmc->AddResource("zh", nullptr, nullptr);
266 
267     std::string outValue;
268     RState state = rm->GetStringFormatById(outValue, NON_EXIST_ID, 101);
269     ASSERT_EQ(NOT_FOUND, state);
270 }
271 
272 /*
273  * @tc.name: ResourceManagerGetStringFormatByIdTest003
274  * @tc.desc: Test GetStringFormatById function
275  * @tc.type: FUNC
276  */
277 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest003, TestSize.Level1)
278 {
279     const char *name = "test_string0";
280     const char *cmp = "向前兼容";
281     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
282     rmc->TestGetStringFormatById(name, jsParams, cmp);
283 }
284 
285 /*
286  * @tc.name: ResourceManagerGetStringFormatByIdTest004
287  * @tc.desc: Test GetStringFormatById function
288  * @tc.type: FUNC
289  */
290 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest004, TestSize.Level1)
291 {
292     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
293     std::string outValue;
294     RState state = rm->GetStringFormatById(NON_EXIST_ID, outValue, jsParams);
295     ASSERT_EQ(ERROR_CODE_RES_ID_NOT_FOUND, state);
296 }
297 
298 /*
299  * @tc.name: ResourceManagerGetStringFormatByIdTest005
300  * @tc.desc: Test GetStringFormatById function
301  * @tc.type: FUNC
302  */
303 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest005, TestSize.Level1)
304 {
305     const char *name = "test_string1";
306     const char *cmp = "%10%d%%d%%";
307     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
308         {{ResourceManager::NapiValueType::NAPI_NUMBER, "10"}};
309     rmc->TestGetStringFormatByName(name, jsParams, cmp);
310 }
311 
312 /*
313  * @tc.name: ResourceManagerGetStringFormatByIdTest006
314  * @tc.desc: Test GetStringFormatById function
315  * @tc.type: FUNC
316  */
317 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest006, TestSize.Level1)
318 {
319     const char *name = "test_string2";
320     const char *cmp = "-9.999 你好";
321     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
322         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-9.999"},
323         {ResourceManager::NapiValueType::NAPI_STRING, " 你好"}};
324     rmc->TestGetStringFormatByName(name, jsParams, cmp);
325 }
326 
327 /*
328  * @tc.name: ResourceManagerGetStringFormatByIdTest007
329  * @tc.desc: Test GetStringFormatById function
330  * @tc.type: FUNC
331  */
332 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest007, TestSize.Level1)
333 {
334     const char *name = "test_string2";
335     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
336     ASSERT_TRUE(ret);
337     int id = rmc->GetResId(name, ResType::STRING);
338     ASSERT_TRUE(id > 0);
339     std::string outValue;
340     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
341         {{ResourceManager::NapiValueType::NAPI_STRING, " 你好"},
342         {ResourceManager::NapiValueType::NAPI_NUMBER, "-9.999"}};
343     RState state = rm->GetStringFormatById(id, outValue, jsParams);
344     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
345 }
346 
347 /*
348  * @tc.name: ResourceManagerGetStringFormatByIdTest008
349  * @tc.desc: Test GetStringFormatById function
350  * @tc.type: FUNC
351  */
352 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest008, TestSize.Level1)
353 {
354     const char *name = "test_string2";
355     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
356     ASSERT_TRUE(ret);
357     int id = rmc->GetResId(name, ResType::STRING);
358     ASSERT_TRUE(id > 0);
359     std::string outValue;
360     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
361         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-9.999"}};
362     RState state = rm->GetStringFormatById(id, outValue, jsParams);
363     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
364 }
365 
366 /*
367  * @tc.name: ResourceManagerGetStringFormatByIdTest009
368  * @tc.desc: Test GetStringFormatById function
369  * @tc.type: FUNC
370  */
371 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest009, TestSize.Level1)
372 {
373     const char *name = "test_string9";
374     const char *cmp = "%d-%d1$d";
375     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
376     rmc->TestGetStringFormatById(name, jsParams, cmp);
377 }
378 
379 /*
380  * @tc.name: ResourceManagerGetStringFormatByIdTest010
381  * @tc.desc: Test GetStringFormatById function
382  * @tc.type: FUNC
383  */
384 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest010, TestSize.Level1)
385 {
386     const char *name = "test_string10";
387     const char *cmp = "%d%%%";
388     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
389     rmc->TestGetStringFormatById(name, jsParams, cmp);
390 }
391 
392 /*
393  * @tc.name: ResourceManagerGetStringFormatByIdTest011
394  * @tc.desc: Test GetStringFormatById function
395  * @tc.type: FUNC
396  */
397 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest011, TestSize.Level1)
398 {
399     const char *name = "test_string11";
400     const char *cmp = "-7";
401     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
402         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-7.5"}};
403     rmc->TestGetStringFormatById(name, jsParams, cmp);
404 }
405 
406 /*
407  * @tc.name: ResourceManagerGetStringFormatByIdTest012
408  * @tc.desc: Test GetStringFormatById function
409  * @tc.type: FUNC
410  */
411 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest012, TestSize.Level1)
412 {
413     const char *name = "test_string12";
414     const char *cmp = "2-1===6.100000-5.000000===你好,world===%hh%%%";
415     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
416         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1.000000"},
417         {ResourceManager::NapiValueType::NAPI_NUMBER, "2.100000"},
418         {ResourceManager::NapiValueType::NAPI_NUMBER, "5.000000"},
419         {ResourceManager::NapiValueType::NAPI_NUMBER, "6.100000"},
420         {ResourceManager::NapiValueType::NAPI_STRING, "world"},
421         {ResourceManager::NapiValueType::NAPI_STRING, "你好,"}};
422     rmc->TestGetStringFormatById(name, jsParams, cmp);
423 }
424 
425 /*
426  * @tc.name: ResourceManagerGetStringFormatByIdTest013
427  * @tc.desc: Test GetStringFormatById function
428  * @tc.type: FUNC
429  */
430 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest013, TestSize.Level1)
431 {
432     const char *name = "test_string13";
433     const char *cmp = "11";
434     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
435         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
436     rmc->TestGetStringFormatById(name, jsParams, cmp);
437 }
438 
439 /*
440  * @tc.name: ResourceManagerGetStringFormatByIdTest014
441  * @tc.desc: Test GetStringFormatById function
442  * @tc.type: FUNC
443  */
444 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest014, TestSize.Level1)
445 {
446     const char *name = "test_string14";
447     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
448     ASSERT_TRUE(ret);
449     int id = rmc->GetResId(name, ResType::STRING);
450     ASSERT_TRUE(id > 0);
451     std::string outValue;
452     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
453         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
454     RState state = rm->GetStringFormatById(id, outValue, jsParams);
455     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
456 }
457 
458 /*
459  * @tc.name: ResourceManagerGetStringFormatByIdTest015
460  * @tc.desc: Test GetStringFormatById function
461  * @tc.type: FUNC
462  */
463 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest015, TestSize.Level1)
464 {
465     const char *name = "test_string15";
466     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
467     ASSERT_TRUE(ret);
468     int id = rmc->GetResId(name, ResType::STRING);
469     ASSERT_TRUE(id > 0);
470     std::string outValue;
471     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
472         {{ResourceManager::NapiValueType::NAPI_STRING, "hhh"}};
473     RState state = rm->GetStringFormatById(id, outValue, jsParams);
474     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
475 }
476 
477 /*
478  * @tc.name: ResourceManagerGetStringFormatByIdTest016
479  * @tc.desc: Test GetStringFormatById function
480  * @tc.type: FUNC
481  */
482 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest016, TestSize.Level1)
483 {
484     const char *name = "test_string16";
485     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
486     ASSERT_TRUE(ret);
487     int id = rmc->GetResId(name, ResType::STRING);
488     ASSERT_TRUE(id > 0);
489     std::string outValue;
490     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
491         {{ResourceManager::NapiValueType::NAPI_STRING, "hhh"}};
492     RState state = rm->GetStringFormatById(id, outValue, jsParams);
493     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
494 }
495 
496 /*
497  * @tc.name: ResourceManagerGetStringFormatByIdTest017
498  * @tc.desc: Test GetStringFormatById function
499  * @tc.type: FUNC
500  */
501 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest017, TestSize.Level1)
502 {
503     const char *name = "test_string17";
504     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
505     ASSERT_TRUE(ret);
506     int id = rmc->GetResId(name, ResType::STRING);
507     ASSERT_TRUE(id > 0);
508     std::string outValue;
509     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
510         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
511     RState state = rm->GetStringFormatById(id, outValue, jsParams);
512     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
513 }
514 
515 /*
516  * @tc.name: ResourceManagerGetStringFormatByIdTest018
517  * @tc.desc: Test GetStringFormatById function
518  * @tc.type: FUNC
519  */
520 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest018, TestSize.Level1)
521 {
522     const char *name = "test_string18";
523     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
524     ASSERT_TRUE(ret);
525     int id = rmc->GetResId(name, ResType::STRING);
526     ASSERT_TRUE(id > 0);
527     std::string outValue;
528     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
529         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
530     RState state = rm->GetStringFormatById(id, outValue, jsParams);
531     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
532 }
533 
534 /*
535  * @tc.name: ResourceManagerGetStringFormatByIdTest019
536  * @tc.desc: Test GetStringFormatById function
537  * @tc.type: FUNC
538  */
539 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest019, TestSize.Level1)
540 {
541     const char *name = "test_string19";
542     const char *cmp = "11";
543     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
544         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"},
545         {ResourceManager::NapiValueType::NAPI_NUMBER, "2"}};
546     rmc->TestGetStringFormatById(name, jsParams, cmp);
547 }
548 
549 /*
550  * @tc.name: ResourceManagerGetStringFormatByIdTest020
551  * @tc.desc: Test GetStringFormatById function
552  * @tc.type: FUNC
553  */
554 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest020, TestSize.Level1)
555 {
556     const char *name = "test_string20";
557     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
558     ASSERT_TRUE(ret);
559     int id = rmc->GetResId(name, ResType::STRING);
560     ASSERT_TRUE(id > 0);
561     std::string outValue;
562     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
563         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
564     RState state = rm->GetStringFormatById(id, outValue, jsParams);
565     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
566 }
567 
568 /*
569  * @tc.name: ResourceManagerGetStringFormatByIdTest021
570  * @tc.desc: Test GetStringFormatById function
571  * @tc.type: FUNC
572  */
573 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest021, TestSize.Level1)
574 {
575     const char *name = "test_string21";
576     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
577     ASSERT_TRUE(ret);
578     int id = rmc->GetResId(name, ResType::STRING);
579     ASSERT_TRUE(id > 0);
580     std::string outValue;
581     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
582         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
583     RState state = rm->GetStringFormatById(id, outValue, jsParams);
584     ASSERT_EQ(ERROR_CODE_RES_ID_FORMAT_ERROR, state);
585 }
586 
587 /*
588  * @tc.name: ResourceManagerGetStringFormatByIdTest022
589  * @tc.desc: Test GetStringFormatById function
590  * @tc.type: FUNC
591  */
592 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest022, TestSize.Level1)
593 {
594     const char *name = "test_string22";
595     const char *cmp = "112";
596     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
597         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"},
598         {ResourceManager::NapiValueType::NAPI_NUMBER, "2"},
599         {ResourceManager::NapiValueType::NAPI_NUMBER, "3"}};
600     rmc->TestGetStringFormatById(name, jsParams, cmp);
601 }
602 
603 /*
604  * @tc.name: ResourceManagerGetStringFormatByIdTest023
605  * @tc.desc: Test GetStringFormatById function
606  * @tc.type: FUNC
607  */
608 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByIdTest023, TestSize.Level1)
609 {
610     const char *name = "test_string22";
611     const char *cmp = "112";
612     rmc->TestGetStringFormatByIdWithVaArgs(name, cmp, 1, 2, 3);
613 }
614 
615 /*
616  * @tc.name: ResourceManagerGetStringFormatByNameTest001
617  * @tc.desc: Test GetStringFormatByName function
618  * @tc.type: FUNC
619  */
620 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest001, TestSize.Level1)
621 {
622     rmc->AddResource("zh", nullptr, nullptr);
623 
624     const char *name = "app_name";
625     std::string outValue;
626     RState state = rm->GetStringFormatByName(outValue, name, 101);
627     ASSERT_EQ(SUCCESS, state);
628     ASSERT_EQ("应用名称", outValue);
629 }
630 
631 /*
632  * @tc.name: ResourceManagerGetStringFormatByNameTest002
633  * @tc.desc: Test GetStringFormatByName function
634  * @tc.type: FUNC
635  */
636 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest002, TestSize.Level1)
637 {
638     rmc->AddResource("zh", nullptr, nullptr);
639 
640     std::string outValue;
641     RState state = rm->GetStringFormatByName(outValue, g_nonExistName, 101);
642     ASSERT_EQ(NOT_FOUND, state);
643 }
644 
645 /*
646  * @tc.name: ResourceManagerGetStringFormatByNameTest003
647  * @tc.desc: Test GetStringFormatByName function
648  * @tc.type: FUNC
649  */
650 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest003, TestSize.Level1)
651 {
652     const char *name = "test_string0";
653     const char *cmp = "向前兼容";
654     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
655     rmc->TestGetStringFormatByName(name, jsParams, cmp);
656 }
657 
658 /*
659  * @tc.name: ResourceManagerGetStringFormatByNameTest004
660  * @tc.desc: Test GetStringFormatByName function
661  * @tc.type: FUNC
662  */
663 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest004, TestSize.Level1)
664 {
665     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
666     std::string outValue;
667     RState state = rm->GetStringFormatByName("NON_EXIST_NAME", outValue, jsParams);
668     ASSERT_EQ(ERROR_CODE_RES_NAME_NOT_FOUND, state);
669 }
670 
671 /*
672  * @tc.name: ResourceManagerGetStringFormatByNameTest005
673  * @tc.desc: Test GetStringFormatByName function
674  * @tc.type: FUNC
675  */
676 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest005, TestSize.Level1)
677 {
678     const char *name = "test_string3";
679     const char *cmp = "abc12.3abc%%\"abc\"abc";
680     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
681         {{ResourceManager::NapiValueType::NAPI_NUMBER, "12.3"},
682         {ResourceManager::NapiValueType::NAPI_STRING, "\"abc\""}};
683     rmc->TestGetStringFormatByName(name, jsParams, cmp);
684 }
685 
686 /*
687  * @tc.name: ResourceManagerGetStringFormatByNameTest006
688  * @tc.desc: Test GetStringFormatByName function
689  * @tc.type: FUNC
690  */
691 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest006, TestSize.Level1)
692 {
693     const char *name = "test_string4";
694     const char *cmp = "%a-320a%%";
695     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
696         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-320"}};
697     rmc->TestGetStringFormatByName(name, jsParams, cmp);
698 }
699 
700 /*
701  * @tc.name: ResourceManagerGetStringFormatByNameTest007
702  * @tc.desc: Test GetStringFormatByName function
703  * @tc.type: FUNC
704  */
705 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest007, TestSize.Level1)
706 {
707     const char *name = "test_string2";
708     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
709     ASSERT_TRUE(ret);
710     std::string outValue;
711     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
712         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-9.999"},
713         {ResourceManager::NapiValueType::NAPI_NUMBER, "abc"}};
714     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
715     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
716 }
717 
718 /*
719  * @tc.name: ResourceManagerGetStringFormatByNameTest008
720  * @tc.desc: Test GetStringFormatByName function
721  * @tc.type: FUNC
722  */
723 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest008, TestSize.Level1)
724 {
725     const char *name = "test_string2";
726     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
727     ASSERT_TRUE(ret);
728     std::string outValue;
729     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
730         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-9.999"}};
731     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
732     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
733 }
734 
735 /*
736  * @tc.name: ResourceManagerGetStringFormatByNameTest009
737  * @tc.desc: Test GetStringFormatById function
738  * @tc.type: FUNC
739  */
740 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest009, TestSize.Level1)
741 {
742     const char *name = "test_string9";
743     const char *cmp = "%d-%d1$d";
744     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
745     rmc->TestGetStringFormatByName(name, jsParams, cmp);
746 }
747 
748 /*
749  * @tc.name: ResourceManagerGetStringFormatByNameTest010
750  * @tc.desc: Test GetStringFormatById function
751  * @tc.type: FUNC
752  */
753 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest010, TestSize.Level1)
754 {
755     const char *name = "test_string10";
756     const char *cmp = "%d%%%";
757     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
758     rmc->TestGetStringFormatByName(name, jsParams, cmp);
759 }
760 
761 /*
762  * @tc.name: ResourceManagerGetStringFormatByNameTest011
763  * @tc.desc: Test GetStringFormatById function
764  * @tc.type: FUNC
765  */
766 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest011, TestSize.Level1)
767 {
768     const char *name = "test_string11";
769     const char *cmp = "-7";
770     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
771         {{ResourceManager::NapiValueType::NAPI_NUMBER, "-7.5"}};
772     rmc->TestGetStringFormatByName(name, jsParams, cmp);
773 }
774 
775 /*
776  * @tc.name: ResourceManagerGetStringFormatByNameTest012
777  * @tc.desc: Test GetStringFormatById function
778  * @tc.type: FUNC
779  */
780 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest012, TestSize.Level1)
781 {
782     const char *name = "test_string12";
783     const char *cmp = "2-1===4.100000-3.000000===你好,world===%hh%%%";
784     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
785         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1.000000"},
786         {ResourceManager::NapiValueType::NAPI_NUMBER, "2.100000"},
787         {ResourceManager::NapiValueType::NAPI_NUMBER, "3.000000"},
788         {ResourceManager::NapiValueType::NAPI_NUMBER, "4.100000"},
789         {ResourceManager::NapiValueType::NAPI_STRING, "world"},
790         {ResourceManager::NapiValueType::NAPI_STRING, "你好,"}};
791     rmc->TestGetStringFormatByName(name, jsParams, cmp);
792 }
793 
794 /*
795  * @tc.name: ResourceManagerGetStringFormatByNameTest013
796  * @tc.desc: Test GetStringFormatById function
797  * @tc.type: FUNC
798  */
799 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest013, TestSize.Level1)
800 {
801     const char *name = "test_string13";
802     const char *cmp = "11";
803     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
804         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
805     rmc->TestGetStringFormatByName(name, jsParams, cmp);
806 }
807 
808 /*
809  * @tc.name: ResourceManagerGetStringFormatByNameTest014
810  * @tc.desc: Test GetStringFormatById function
811  * @tc.type: FUNC
812  */
813 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest014, TestSize.Level1)
814 {
815     const char *name = "test_string14";
816     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
817     ASSERT_TRUE(ret);
818     std::string outValue;
819     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
820         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
821     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
822     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
823 }
824 
825 /*
826  * @tc.name: ResourceManagerGetStringFormatByNameTest015
827  * @tc.desc: Test GetStringFormatById function
828  * @tc.type: FUNC
829  */
830 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest015, TestSize.Level1)
831 {
832     const char *name = "test_string15";
833     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
834     ASSERT_TRUE(ret);
835     std::string outValue;
836     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
837         {{ResourceManager::NapiValueType::NAPI_STRING, "hhh"}};
838     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
839     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
840 }
841 
842 /*
843  * @tc.name: ResourceManagerGetStringFormatByNameTest016
844  * @tc.desc: Test GetStringFormatById function
845  * @tc.type: FUNC
846  */
847 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest016, TestSize.Level1)
848 {
849     const char *name = "test_string16";
850     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
851     ASSERT_TRUE(ret);
852     std::string outValue;
853     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
854         {{ResourceManager::NapiValueType::NAPI_STRING, "hhh"}};
855     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
856     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
857 }
858 
859 /*
860  * @tc.name: ResourceManagerGetStringFormatByNameTest017
861  * @tc.desc: Test GetStringFormatById function
862  * @tc.type: FUNC
863  */
864 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest017, TestSize.Level1)
865 {
866     const char *name = "test_string17";
867     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
868     ASSERT_TRUE(ret);
869     std::string outValue;
870     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
871         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
872     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
873     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
874 }
875 
876 /*
877  * @tc.name: ResourceManagerGetStringFormatByNameTest018
878  * @tc.desc: Test GetStringFormatById function
879  * @tc.type: FUNC
880  */
881 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest018, TestSize.Level1)
882 {
883     const char *name = "test_string18";
884     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
885     ASSERT_TRUE(ret);
886     std::string outValue;
887     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
888         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
889     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
890     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
891 }
892 
893 /*
894  * @tc.name: ResourceManagerGetStringFormatByNameTest019
895  * @tc.desc: Test GetStringFormatById function
896  * @tc.type: FUNC
897  */
898 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest019, TestSize.Level1)
899 {
900     const char *name = "test_string19";
901     const char *cmp = "11";
902     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
903         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"},
904         {ResourceManager::NapiValueType::NAPI_NUMBER, "2"}};
905     rmc->TestGetStringFormatByName(name, jsParams, cmp);
906 }
907 
908 /*
909  * @tc.name: ResourceManagerGetStringFormatByNameTest020
910  * @tc.desc: Test GetStringFormatById function
911  * @tc.type: FUNC
912  */
913 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest020, TestSize.Level1)
914 {
915     const char *name = "test_string20";
916     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
917     ASSERT_TRUE(ret);
918     std::string outValue;
919     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
920         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
921     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
922     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
923 }
924 
925 /*
926  * @tc.name: ResourceManagerGetStringFormatByNameTest021
927  * @tc.desc: Test GetStringFormatById function
928  * @tc.type: FUNC
929  */
930 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest021, TestSize.Level1)
931 {
932     const char *name = "test_string21";
933     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
934     ASSERT_TRUE(ret);
935     std::string outValue;
936     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
937         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"}};
938     RState state = rm->GetStringFormatByName(name, outValue, jsParams);
939     ASSERT_EQ(ERROR_CODE_RES_NAME_FORMAT_ERROR, state);
940 }
941 
942 /*
943  * @tc.name: ResourceManagerGetStringFormatByNameTest022
944  * @tc.desc: Test GetStringFormatById function
945  * @tc.type: FUNC
946  */
947 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest022, TestSize.Level1)
948 {
949     const char *name = "test_string22";
950     const char *cmp = "112";
951     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams =
952         {{ResourceManager::NapiValueType::NAPI_NUMBER, "1"},
953         {ResourceManager::NapiValueType::NAPI_NUMBER, "2"},
954         {ResourceManager::NapiValueType::NAPI_NUMBER, "3"}};
955     rmc->TestGetStringFormatByName(name, jsParams, cmp);
956 }
957 
958 /*
959  * @tc.name: ResourceManagerGetStringFormatByNameTest023
960  * @tc.desc: Test GetStringFormatByName with va_list function
961  * @tc.type: FUNC
962  */
963 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest023, TestSize.Level1)
964 {
965     const char *name = "test_string22";
966     const char *cmp = "112";
967     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, 1, 2, 3);
968 }
969 
970 /*
971  * @tc.name: ResourceManagerGetStringFormatByNameTest024
972  * @tc.desc: Test GetStringFormatByName with va_list function
973  * @tc.type: FUNC
974  */
975 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest024, TestSize.Level1)
976 {
977     const char *name = "test_string1";
978     const char *cmp = "%10%d%%d%%";
979     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, 10);
980 }
981 
982 /*
983  * @tc.name: ResourceManagerGetStringFormatByNameTest025
984  * @tc.desc: Test GetStringFormatByName with va_list function
985  * @tc.type: FUNC
986  */
987 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest025, TestSize.Level1)
988 {
989     const char *name = "test_string2";
990     const char *cmp = "-9.999000 你好";
991     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, -9.999, " 你好");
992 }
993 
994 /*
995  * @tc.name: ResourceManagerGetStringFormatByNameTest026
996  * @tc.desc: Test GetStringFormatByName with va_list function
997  * @tc.type: FUNC
998  */
999 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest026, TestSize.Level1)
1000 {
1001     const char *name = "test_string13";
1002     const char *cmp = "11";
1003     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, 1);
1004 }
1005 
1006 /*
1007  * @tc.name: ResourceManagerGetStringFormatByNameTest027
1008  * @tc.desc: Test GetStringFormatByName with va_list function
1009  * @tc.type: FUNC
1010  */
1011 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest027, TestSize.Level1)
1012 {
1013     const char *name = "test_string15";
1014     const char *cmp = "100";
1015     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, 100);
1016 }
1017 
1018 /*
1019  * @tc.name: ResourceManagerGetStringFormatByNameTest028
1020  * @tc.desc: Test GetStringFormatByName with va_list function
1021  * @tc.type: FUNC
1022  */
1023 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest028, TestSize.Level1)
1024 {
1025     const char *name = "test_string16";
1026     const char *cmp = "1.230000";
1027     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, 1.23);
1028 }
1029 
1030 /*
1031  * @tc.name: ResourceManagerGetStringFormatByNameTest029
1032  * @tc.desc: Test GetStringFormatByName with va_list function
1033  * @tc.type: FUNC
1034  */
1035 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringFormatByNameTest029, TestSize.Level1)
1036 {
1037     const char *name = "test_string17";
1038     const char *cmp = "Hello World";
1039     rmc->TestGetStringFormatByNameWithVaArgs(name, cmp, "Hello World");
1040 }
1041 
1042 /*
1043  * @tc.name: ResourceManagerGetStringArrayByIdTest001
1044  * @tc.desc: Test GetStringArrayById function, file case.
1045  * @tc.type: FUNC
1046  */
1047 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringArrayByIdTest001, TestSize.Level1)
1048 {
1049     rmc->AddResource("zh", nullptr, nullptr);
1050 
1051     rmc->TestGetStringArrayById("size");
1052 }
1053 
1054 /*
1055  * @tc.name: ResourceManagerGetStringArrayByIdTest002
1056  * @tc.desc: Test GetStringArrayById function, file case.
1057  * @tc.type: FUNC
1058  */
1059 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringArrayByIdTest002, TestSize.Level1)
1060 {
1061     rmc->AddResource("zh", nullptr, nullptr);
1062 
1063     RState state;
1064     // error case
1065     // not found case
1066     std::vector<std::string> outValue;
1067     state = rm->GetStringArrayById(NON_EXIST_ID, outValue);
1068     ASSERT_EQ(ERROR_CODE_RES_ID_NOT_FOUND, state);
1069 }
1070 
1071 /*
1072  * @tc.name: ResourceManagerGetStringArrayByNameTest001
1073  * @tc.desc: Test GetStringArrayByName function, file case.
1074  * @tc.type: FUNC
1075  */
1076 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringArrayByNameTest001, TestSize.Level1)
1077 {
1078     rmc->AddResource("zh", nullptr, nullptr);
1079 
1080     rmc->TestGetStringArrayByName("size");
1081 }
1082 
1083 /*
1084  * @tc.name: ResourceManagerGetStringArrayByNameTest002
1085  * @tc.desc: Test GetStringArrayByName function, file case.
1086  * @tc.type: FUNC
1087  */
1088 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringArrayByNameTest002, TestSize.Level1)
1089 {
1090     rmc->AddResource("zh", nullptr, nullptr);
1091 
1092     RState state;
1093     // error case
1094     // not found case
1095     std::vector<std::string> outValue;
1096     state = rm->GetStringArrayByName(g_nonExistName, outValue);
1097     ASSERT_EQ(ERROR_CODE_RES_NAME_NOT_FOUND, state);
1098 }
1099 
1100 
1101 /*
1102  * @tc.name: ResourceManagerGetPluralStringByIdTest001
1103  * @tc.desc: Test GetPluralStringById function, file case.
1104  * @tc.type: FUNC
1105  */
1106 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdTest001, TestSize.Level1)
1107 {
1108     rmc->AddResource("en", nullptr, "US");
1109 
1110     int quantity = 1;
1111     rmc->TestPluralStringById(quantity, "%d apple", false);
1112 
1113     quantity = 101;
1114     rmc->TestPluralStringById(quantity, "%d apples", false);
1115 }
1116 
1117 /*
1118  * @tc.name: ResourceManagerGetPluralStringByIdTest002
1119  * @tc.desc: Test GetPluralStringById function, file case.
1120  * @tc.type: FUNC
1121  */
1122 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdTest002, TestSize.Level1)
1123 {
1124     rmc->AddResource("zh", nullptr, "CN");
1125 
1126     int quantity = 1;
1127     rmc->TestPluralStringById(quantity, "%d apples", false);
1128 
1129     quantity = 101;
1130     rmc->TestPluralStringById(quantity, "%d apples", false);
1131 }
1132 
1133 /*
1134  * @tc.name: ResourceManagerGetPluralStringByIdTest003
1135  * @tc.desc: Test GetPluralStringById function, file case.
1136  * @tc.type: FUNC
1137  */
1138 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdTest003, TestSize.Level1)
1139 {
1140     rmc->AddResource("pl", nullptr, "PL");
1141 
1142     int quantity = 1;
1143     rmc->TestPluralStringById(quantity, "1 jabłko");
1144 
1145     quantity = 2;
1146     rmc->TestPluralStringById(quantity, "%d jabłka");
1147 
1148     quantity = 23;
1149     rmc->TestPluralStringById(quantity, "%d jabłka");
1150 
1151     quantity = 12;
1152     rmc->TestPluralStringById(quantity, "%d jabłek");
1153 }
1154 
1155 /*
1156  * @tc.name: ResourceManagerGetPluralStringByIdTest004
1157  * @tc.desc: Test GetPluralStringById function, file case.
1158  * @tc.type: FUNC
1159  */
1160 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdTest004, TestSize.Level1)
1161 {
1162     rmc->AddResource("ar", nullptr, "SA");
1163 
1164     int quantity = 0;
1165     rmc->TestPluralStringById(quantity, "zero-0");
1166     quantity = 1;
1167     rmc->TestPluralStringById(quantity, "one-1");
1168     quantity = 2;
1169     rmc->TestPluralStringById(quantity, "two-2");
1170     quantity = 5;
1171     rmc->TestPluralStringById(quantity, "few-%d");
1172     quantity = 12;
1173     rmc->TestPluralStringById(quantity, "many-%d");
1174     quantity = 500;
1175     rmc->TestPluralStringById(quantity, "other-%d");
1176 }
1177 
1178 /*
1179  * @tc.name: ResourceManagerGetPluralStringByIdTest005
1180  * @tc.desc: Test GetPluralStringById function, file case.
1181  * @tc.type: FUNC
1182  */
1183 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdTest005, TestSize.Level1)
1184 {
1185     rmc->AddResource("ar", nullptr, "SA");
1186 
1187     RState state;
1188     std::string outValue;
1189     state = rm->GetPluralStringById(NON_EXIST_ID, 1, outValue);
1190     ASSERT_EQ(NOT_FOUND, state);
1191 }
1192 
1193 /*
1194  * @tc.name: ResourceManagerGetPluralStringByNameTest001
1195  * @tc.desc: Test GetPluralStringByName function, file case.
1196  * @tc.type: FUNC
1197  */
1198 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByNameTest001, TestSize.Level1)
1199 {
1200     rmc->AddResource("en", nullptr, "US");
1201 
1202     int quantity = 1;
1203     rmc->TestPluralStringByName(quantity, "%d apple", false);
1204 
1205     quantity = 101;
1206     rmc->TestPluralStringByName(quantity, "%d apples", false);
1207 }
1208 
1209 /*
1210  * @tc.name: ResourceManagerGetPluralStringByNameTest002
1211  * @tc.desc: Test GetPluralStringByName function, file case.
1212  * @tc.type: FUNC
1213  */
1214 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByNameTest002, TestSize.Level1)
1215 {
1216     rmc->AddResource("ar", nullptr, "SA");
1217 
1218     RState state;
1219     std::string outValue;
1220     state = rm->GetPluralStringByName(g_nonExistName, 1, outValue);
1221     ASSERT_EQ(NOT_FOUND, state);
1222 }
1223 
1224 /*
1225  * @tc.name: ResourceManagerGetPluralStringByIdFormatTest001
1226  * @tc.desc: Test GetPluralStringByIdFormat function, file case.
1227  * @tc.type: FUNC
1228  */
1229 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdFormatTest001, TestSize.Level1)
1230 {
1231     rmc->AddResource("zh", nullptr, "CN");
1232 
1233     int quantity = 1;
1234     rmc->TestPluralStringById(quantity, "1 apples", true);
1235 
1236     quantity = 101;
1237     rmc->TestPluralStringById(quantity, "101 apples", true);
1238 }
1239 
1240 /*
1241  * @tc.name: ResourceManagerGetPluralStringByIdFormatTest002
1242  * @tc.desc: Test GetPluralStringByIdFormat function, file case.
1243  * @tc.type: FUNC
1244  */
1245 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdFormatTest002, TestSize.Level1)
1246 {
1247     rmc->AddResource("ar", nullptr, "SA");
1248 
1249     RState state;
1250     std::string outValue;
1251     state = rm->GetPluralStringByIdFormat(outValue, NON_EXIST_ID, 1, 1);
1252     ASSERT_EQ(ERROR_CODE_RES_ID_NOT_FOUND, state);
1253 }
1254 
1255 /*
1256  * @tc.name: ResourceManagerGetPluralStringByIdFormatTest003
1257  * @tc.desc: Test GetPluralStringByIdFormat function, file case.
1258  * @tc.type: FUNC
1259  */
1260 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdFormatTest003, TestSize.Level1)
1261 {
1262     rmc->AddResource("ar", nullptr, "SA");
1263 
1264     RState state;
1265     std::string outValue;
1266     int id = rmc->GetResId("app_name", ResType::STRING);
1267     state = rm->GetPluralStringByIdFormat(outValue, id, 1, 1);
1268     ASSERT_EQ(ERROR_CODE_RES_NOT_FOUND_BY_ID, state);
1269 }
1270 
1271 /*
1272  * @tc.name: ResourceManagerGetPluralStringByIdFormatTest004
1273  * @tc.desc: Test GetPluralStringByIdFormat function, file case.
1274  * @tc.type: FUNC
1275  */
1276 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByIdFormatTest004, TestSize.Level1)
1277 {
1278     rmc->AddColorModeResource(DEVICE_PHONE, LIGHT, SCREEN_DENSITY_LDPI / BASE_DPI);
1279 
1280     RState state;
1281     std::string outValue;
1282     int quantity = 1;
1283     int id = rmc->GetResId("eat_apple1", ResType::PLURALS);
1284     state = rm->GetPluralStringByIdFormat(outValue, id, quantity);
1285     ASSERT_EQ(ERROR_CODE_RES_REF_TOO_MUCH, state);
1286 }
1287 
1288 /*
1289  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest001
1290  * @tc.desc: Test GetFormatPluralStringById function
1291  * @tc.type: FUNC
1292  */
1293 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest001, TestSize.Level1)
1294 {
1295     rmc->AddResource("zh", nullptr, "CN");
1296     double quantity = 1;
1297     int id = rmc->GetResId("eat_apple", ResType::PLURALS);
1298     ASSERT_TRUE(id > 0);
1299     rmc->TestFormatPluralStringById(id, quantity, "1 apples");
1300 }
1301 
1302 /*
1303  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest002
1304  * @tc.desc: Test GetFormatPluralStringById function
1305  * @tc.type: FUNC
1306  */
1307 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest002, TestSize.Level1)
1308 {
1309     rmc->AddResource("en", nullptr, "US");
1310     double quantity = 1;
1311     int id = rmc->GetResId("eat_apple", ResType::PLURALS);
1312     ASSERT_TRUE(id > 0);
1313     rmc->TestFormatPluralStringById(id, quantity, "1 apple");
1314 
1315     quantity = 10;
1316     rmc->TestFormatPluralStringById(id, quantity, "10 apples");
1317 }
1318 
1319 /*
1320  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest003
1321  * @tc.desc: Test GetFormatPluralStringById function
1322  * @tc.type: FUNC
1323  */
1324 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest003, TestSize.Level1)
1325 {
1326     rmc->AddResource("zh", nullptr, "CN");
1327     double quantity = 1;
1328     int id = 0;
1329     RState state;
1330     std::string outValue;
1331     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
1332     state = rm->GetFormatPluralStringById(outValue, id, quantity, jsParams);
1333     EXPECT_EQ(state, ERROR_CODE_RES_ID_NOT_FOUND);
1334 }
1335 
1336 /*
1337  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest004
1338  * @tc.desc: Test GetFormatPluralStringById function
1339  * @tc.type: FUNC
1340  */
1341 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest004, TestSize.Level1)
1342 {
1343     rmc->AddResource("zh", nullptr, "CN");
1344     double quantity = 1;
1345     int id = rmc->GetResId("app_name", ResType::STRING);
1346     ASSERT_TRUE(id > 0);
1347     RState state;
1348     std::string outValue;
1349     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
1350     state = rm->GetFormatPluralStringById(outValue, id, quantity, jsParams);
1351     EXPECT_EQ(state, ERROR_CODE_RES_NOT_FOUND_BY_ID);
1352 }
1353 
1354 /*
1355  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest005
1356  * @tc.desc: Test GetFormatPluralStringById function
1357  * @tc.type: FUNC
1358  */
1359 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest005, TestSize.Level1)
1360 {
1361     rmc->AddResource("zh", nullptr, "CN");
1362     double quantity = 1;
1363     int id = rmc->GetResId("eat_apple", ResType::PLURALS);
1364     ASSERT_TRUE(id > 0);
1365     RState state;
1366     std::string outValue;
1367     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
1368     jsParams.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_STRING, "1"));
1369     state = rm->GetFormatPluralStringById(outValue, id, quantity, jsParams);
1370     EXPECT_EQ(state, ERROR_CODE_RES_ID_FORMAT_ERROR);
1371 }
1372 
1373 /*
1374  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest006
1375  * @tc.desc: Test GetFormatPluralStringById function
1376  * @tc.type: FUNC
1377  */
1378 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest006, TestSize.Level1)
1379 {
1380     rmc->AddResource("en", nullptr, "US");
1381     RState state;
1382     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1383     std::string outValue;
1384     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1385     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_NUMBER, "1"));
1386     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_NUMBER, "1.1"));
1387     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_STRING, "aaa"));
1388     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_NUMBER, "2.123456"));
1389     int id = rmc->GetResId("eat_apple2", ResType::PLURALS);
1390     state = rm->GetFormatPluralStringById(outValue, id, quantity, params);
1391     ASSERT_EQ(SUCCESS, state);
1392     EXPECT_EQ("1 apple, 1.1, aaa, 2.12", outValue);
1393 
1394     rmc->TestGetFormatPluralStringById(outValue, id, quantity, 1, 1.1, "aaa");
1395     ASSERT_EQ(SUCCESS, state);
1396     EXPECT_EQ("1 apple, 1.1, aaa, 2.12", outValue);
1397 
1398     quantity = { false, 0, 2.1 };
1399     state = rm->GetFormatPluralStringById(outValue, id, quantity, params);
1400     ASSERT_EQ(SUCCESS, state);
1401     EXPECT_EQ("1 apples, 1.1, aaa, 2.12", outValue);
1402 
1403     state = rmc->TestGetFormatPluralStringById(outValue, id, quantity, 1, 1.1, "aaa");
1404     ASSERT_EQ(SUCCESS, state);
1405     EXPECT_EQ("1 apples, 1.1, aaa, 2.12", outValue);
1406 }
1407 
1408 /*
1409  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest007
1410  * @tc.desc: Test GetFormatPluralStringById function
1411  * @tc.type: FUNC
1412  */
1413 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest007, TestSize.Level1)
1414 {
1415     rmc->AddResource("zh", nullptr, "CN");
1416     int id = rmc->GetResId("eat_apple", ResType::PLURALS);
1417     ASSERT_TRUE(id > 0);
1418     RState state;
1419     std::string outValue;
1420     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1421     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1422     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_STRING, "1"));
1423     state = rm->GetFormatPluralStringById(outValue, id, quantity, params);
1424     EXPECT_EQ(state, ERROR_CODE_RES_ID_FORMAT_ERROR);
1425 }
1426 
1427 /*
1428  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest008
1429  * @tc.desc: Test GetFormatPluralStringById function
1430  * @tc.type: FUNC
1431  */
1432 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest008, TestSize.Level1)
1433 {
1434     rmc->AddResource("zh", nullptr, "CN");
1435     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1436     int id = rmc->GetResId("app_name", ResType::STRING);
1437     ASSERT_TRUE(id > 0);
1438     RState state;
1439     std::string outValue;
1440     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1441     state = rm->GetFormatPluralStringById(outValue, id, quantity, params);
1442     EXPECT_EQ(state, ERROR_CODE_RES_NOT_FOUND_BY_ID);
1443 
1444     state = rmc->TestGetFormatPluralStringById(outValue, id, quantity);
1445     EXPECT_EQ(state, ERROR_CODE_RES_NOT_FOUND_BY_ID);
1446 }
1447 
1448 /*
1449  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest009
1450  * @tc.desc: Test GetFormatPluralStringById function
1451  * @tc.type: FUNC
1452  */
1453 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest009, TestSize.Level1)
1454 {
1455     rmc->AddResource("zh", nullptr, "CN");
1456     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1457     int id = rmc->GetResId("eat_apple1", ResType::PLURALS);
1458     RState state;
1459     std::string outValue;
1460     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1461     state = rm->GetFormatPluralStringById(outValue, id, quantity, params);
1462     EXPECT_EQ(state, ERROR_CODE_RES_REF_TOO_MUCH);
1463 
1464     state = rmc->TestGetFormatPluralStringById(outValue, id, quantity);
1465     EXPECT_EQ(state, ERROR_CODE_RES_REF_TOO_MUCH);
1466 }
1467 
1468 /*
1469  * @tc.name: ResourceManagerGetFormatPluralStringByIdTest010
1470  * @tc.desc: Test GetFormatPluralStringById function
1471  * @tc.type: FUNC
1472  */
1473 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByIdTest010, TestSize.Level1)
1474 {
1475     rmc->AddResource("zh", nullptr, "CN");
1476     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1477     int id = 0;
1478     RState state;
1479     std::string outValue;
1480     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1481     state = rm->GetFormatPluralStringById(outValue, id, quantity, params);
1482     EXPECT_EQ(state, ERROR_CODE_RES_ID_NOT_FOUND);
1483 
1484     state = rmc->TestGetFormatPluralStringById(outValue, id, quantity);
1485     EXPECT_EQ(state, ERROR_CODE_RES_ID_NOT_FOUND);
1486 }
1487 
1488 /*
1489  * @tc.name: ResourceManagerGetPluralStringByNameFormatTest001
1490  * @tc.desc: Test GetPluralStringByNameFormat function, file case.
1491  * @tc.type: FUNC
1492  */
1493 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByNameFormatTest001, TestSize.Level1)
1494 {
1495     rmc->AddResource("zh", nullptr, "CN");
1496 
1497     int quantity = 1;
1498     rmc->TestPluralStringByName(quantity, "1 apples", true);
1499 
1500     quantity = 101;
1501     rmc->TestPluralStringByName(quantity, "101 apples", true);
1502 }
1503 
1504 /*
1505  * @tc.name: ResourceManagerGetPluralStringByNameFormatTest002
1506  * @tc.desc: Test GetPluralStringByNameFormat function, file case.
1507  * @tc.type: FUNC
1508  */
1509 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByNameFormatTest002, TestSize.Level1)
1510 {
1511     rmc->AddResource("ar", nullptr, "SA");
1512 
1513     RState state;
1514     std::string outValue;
1515     state = rm->GetPluralStringByNameFormat(outValue, g_nonExistName, 1, 1);
1516     ASSERT_EQ(ERROR_CODE_RES_NAME_NOT_FOUND, state);
1517 }
1518 
1519 /*
1520  * @tc.name: ResourceManagerGetPluralStringByNameFormatTest003
1521  * @tc.desc: Test GetPluralStringByNameFormat function, file case.
1522  * @tc.type: FUNC
1523  */
1524 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByNameFormatTest003, TestSize.Level1)
1525 {
1526     bool ret = ((ResourceManagerImpl*)rm)->AddResource(FormatFullPath(g_overlayResFilePath).c_str());
1527     ASSERT_TRUE(ret);
1528     std::string outValue;
1529     const char* eatApple = "eat_apple";
1530     RState state = rm->GetPluralStringByNameFormat(outValue, eatApple, 1, 1);
1531     ASSERT_EQ(ERROR_CODE_RES_NOT_FOUND_BY_NAME, state);
1532 }
1533 
1534 /*
1535  * @tc.name: ResourceManagerGetPluralStringByNameFormatTest004
1536  * @tc.desc: Test GetPluralStringByNameFormat function, file case.
1537  * @tc.type: FUNC
1538  */
1539 HWTEST_F(ResourceManagerTestString, ResourceManagerGetPluralStringByNameFormatTest004, TestSize.Level1)
1540 {
1541     rmc->AddColorModeResource(DEVICE_PHONE, LIGHT, SCREEN_DENSITY_LDPI / BASE_DPI);
1542 
1543     std::string outValue;
1544     const char* eatApple = "eat_apple1";
1545     int quantity = 1;
1546     RState state = rm->GetPluralStringByNameFormat(outValue, eatApple, quantity);
1547     ASSERT_EQ(ERROR_CODE_RES_REF_TOO_MUCH, state);
1548 }
1549 
1550 /*
1551  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest001
1552  * @tc.desc: Test GetFormatPluralStringByName function
1553  * @tc.type: FUNC
1554  */
1555 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest001, TestSize.Level1)
1556 {
1557     rmc->AddResource("zh", nullptr, "CN");
1558     double quantity = 1;
1559     rmc->TestFormatPluralStringByName("eat_apple", quantity, "1 apples");
1560 }
1561 
1562 /*
1563  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest002
1564  * @tc.desc: Test GetFormatPluralStringByName function
1565  * @tc.type: FUNC
1566  */
1567 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest002, TestSize.Level1)
1568 {
1569     rmc->AddResource("en", nullptr, "US");
1570     double quantity = 1;
1571     rmc->TestFormatPluralStringByName("eat_apple", quantity, "1 apple");
1572 
1573     quantity = 10;
1574     rmc->TestFormatPluralStringByName("eat_apple", quantity, "10 apples");
1575 }
1576 
1577 /*
1578  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest003
1579  * @tc.desc: Test GetFormatPluralStringByName function
1580  * @tc.type: FUNC
1581  */
1582 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest003, TestSize.Level1)
1583 {
1584     rmc->AddResource("zh", nullptr, "CN");
1585     double quantity = 1;
1586     RState state;
1587     std::string outValue;
1588     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
1589     state = rm->GetFormatPluralStringByName(outValue, "no_exist_plural", quantity, jsParams);
1590     EXPECT_EQ(state, ERROR_CODE_RES_NAME_NOT_FOUND);
1591 }
1592 
1593 /*
1594  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest004
1595  * @tc.desc: Test GetFormatPluralStringByName function
1596  * @tc.type: FUNC
1597  */
1598 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest004, TestSize.Level1)
1599 {
1600     rmc->AddResource("zh", nullptr, "CN");
1601     double quantity = 1;
1602     RState state;
1603     std::string outValue;
1604     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> jsParams;
1605     jsParams.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_STRING, "1"));
1606     state = rm->GetFormatPluralStringByName(outValue, "eat_apple", quantity, jsParams);
1607     EXPECT_EQ(state, ERROR_CODE_RES_NAME_FORMAT_ERROR);
1608 }
1609 
1610 /*
1611  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest005
1612  * @tc.desc: Test GetFormatPluralStringByName function
1613  * @tc.type: FUNC
1614  */
1615 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest005, TestSize.Level1)
1616 {
1617     rmc->AddResource("en", nullptr, "US");
1618     RState state;
1619     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1620     std::string outValue;
1621     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1622     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_NUMBER, "1"));
1623     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_NUMBER, "1.1"));
1624     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_STRING, "aaa"));
1625     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_NUMBER, "2.123456"));
1626     const char* name = "eat_apple2";
1627     state = rm->GetFormatPluralStringByName(outValue, name, quantity, params);
1628     ASSERT_EQ(SUCCESS, state);
1629     EXPECT_EQ("1 apple, 1.1, aaa, 2.12", outValue);
1630 
1631     state = rmc->TestGetFormatPluralStringByName(outValue, name, quantity, 1, 1.1, "aaa");
1632     ASSERT_EQ(SUCCESS, state);
1633     EXPECT_EQ("1 apple, 1.1, aaa, 2.12", outValue);
1634 
1635     quantity = { false, 0, 2.1 };
1636     state = rm->GetFormatPluralStringByName(outValue, name, quantity, params);
1637     ASSERT_EQ(SUCCESS, state);
1638     EXPECT_EQ("1 apples, 1.1, aaa, 2.12", outValue);
1639 
1640     state = rmc->TestGetFormatPluralStringByName(outValue, name, quantity, 1, 1.1, "aaa");
1641     ASSERT_EQ(SUCCESS, state);
1642     EXPECT_EQ("1 apples, 1.1, aaa, 2.12", outValue);
1643 }
1644 
1645  /*
1646  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest006
1647  * @tc.desc: Test GetFormatPluralStringByName function
1648  * @tc.type: FUNC
1649  */
1650 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest006, TestSize.Level1)
1651 {
1652     rmc->AddResource("zh", nullptr, "CN");
1653     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1654     RState state;
1655     std::string outValue;
1656     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1657     params.push_back(std::make_tuple(ResourceManager::NapiValueType::NAPI_STRING, "1"));
1658     state = rm->GetFormatPluralStringByName(outValue, "eat_apple", quantity, params);
1659     EXPECT_EQ(state, ERROR_CODE_RES_NAME_FORMAT_ERROR);
1660 }
1661 
1662 /*
1663  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest007
1664  * @tc.desc: Test GetFormatPluralStringByName function
1665  * @tc.type: FUNC
1666  */
1667 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest007, TestSize.Level1)
1668 {
1669     rmc->AddResource("zh", nullptr, "CN");
1670     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1671     RState state;
1672     std::string outValue;
1673     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1674     state = rm->GetFormatPluralStringByName(outValue, "no_exist_plural", quantity, params);
1675     EXPECT_EQ(state, ERROR_CODE_RES_NAME_NOT_FOUND);
1676 
1677     state = rmc->TestGetFormatPluralStringByName(outValue, "no_exist_plural", quantity);
1678     EXPECT_EQ(state, ERROR_CODE_RES_NAME_NOT_FOUND);
1679 }
1680 
1681 /*
1682  * @tc.name: ResourceManagerGetFormatPluralStringByNameTest008
1683  * @tc.desc: Test GetFormatPluralStringByName function
1684  * @tc.type: FUNC
1685  */
1686 HWTEST_F(ResourceManagerTestString, ResourceManagerGetFormatPluralStringByNameTest008, TestSize.Level1)
1687 {
1688     rmc->AddResource("zh", nullptr, "CN");
1689     ResourceManager::Quantity quantity = { true, 1, 0.0 };
1690     RState state;
1691     std::string outValue;
1692     std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> params;
1693     state = rm->GetFormatPluralStringByName(outValue, "eat_apple1", quantity, params);
1694     EXPECT_EQ(state, ERROR_CODE_RES_REF_TOO_MUCH);
1695 
1696     state = rmc->TestGetFormatPluralStringByName(outValue, "eat_apple1", quantity);
1697     EXPECT_EQ(state, ERROR_CODE_RES_REF_TOO_MUCH);
1698 }
1699 
1700 /*
1701  * @tc.name: ResourceManagerGetStringByNameForMccMncTest001
1702  * @tc.desc: Test GetStringByName
1703  * @tc.type: FUNC
1704  */
1705 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest001, TestSize.Level1)
1706 {
1707     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1708     ASSERT_TRUE(ret);
1709     auto rc = CreateResConfig();
1710     if (rc == nullptr) {
1711         EXPECT_TRUE(false);
1712         return;
1713     }
1714     rc->SetLocaleInfo("en", nullptr, nullptr);
1715     rc->SetDeviceType(DEVICE_TV);
1716     rc->SetColorMode(LIGHT);
1717     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1718     rm->UpdateResConfig(*rc);
1719     delete rc;
1720 
1721     RState rState;
1722     std::string outValue;
1723     rState = rm->GetStringByName("mccmnc_str", outValue);
1724     ASSERT_EQ(SUCCESS, rState);
1725     ASSERT_EQ("str_en_us_light", outValue);
1726 }
1727 
1728 /*
1729  * @tc.name: ResourceManagerGetStringByNameForMccMncTest002
1730  * @tc.desc: Test GetStringByName
1731  * @tc.type: FUNC
1732  */
1733 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest002, TestSize.Level1)
1734 {
1735     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1736     ASSERT_TRUE(ret);
1737     auto rc = CreateResConfig();
1738     if (rc == nullptr) {
1739         EXPECT_TRUE(false);
1740         return;
1741     }
1742     rc->SetLocaleInfo("zh", nullptr, nullptr);
1743     rc->SetDeviceType(DEVICE_TV);
1744     rc->SetColorMode(LIGHT);
1745     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1746     rm->UpdateResConfig(*rc);
1747     delete rc;
1748 
1749     RState rState;
1750     std::string outValue;
1751     rState = rm->GetStringByName("mccmnc_str", outValue);
1752     ASSERT_EQ(SUCCESS, rState);
1753     ASSERT_EQ("str_zh_cn", outValue);
1754 }
1755 
1756 /*
1757  * @tc.name: ResourceManagerGetStringByNameForMccMncTest003
1758  * @tc.desc: Test GetStringByName
1759  * @tc.type: FUNC
1760  */
1761 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest003, TestSize.Level1)
1762 {
1763     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1764     ASSERT_TRUE(ret);
1765     auto rc = CreateResConfig();
1766     if (rc == nullptr) {
1767         EXPECT_TRUE(false);
1768         return;
1769     }
1770     rc->SetLocaleInfo("en", nullptr, nullptr);
1771     rc->SetMcc(460);
1772     rc->SetMnc(101);
1773     rc->SetDeviceType(DEVICE_TV);
1774     rc->SetColorMode(LIGHT);
1775     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1776 
1777     rm->UpdateResConfig(*rc);
1778     delete rc;
1779 
1780     RState rState;
1781     std::string outValue;
1782     rState = rm->GetStringByName("mccmnc_str", outValue);
1783     ASSERT_EQ(SUCCESS, rState);
1784     ASSERT_EQ("str_mcc460_mnc101_en_light", outValue);
1785 }
1786 
1787 /*
1788  * @tc.name: ResourceManagerGetStringByNameForMccMncTest004
1789  * @tc.desc: Test GetStringByName
1790  * @tc.type: FUNC
1791  */
1792 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest004, TestSize.Level1)
1793 {
1794     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1795     ASSERT_TRUE(ret);
1796 
1797     auto rc = CreateResConfig();
1798     if (rc == nullptr) {
1799         EXPECT_TRUE(false);
1800         return;
1801     }
1802     rc->SetLocaleInfo("en", nullptr, nullptr);
1803     rc->SetMcc(460);
1804     rc->SetMnc(1);
1805     rc->SetDeviceType(DEVICE_TV);
1806     rc->SetColorMode(LIGHT);
1807     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1808     rm->UpdateResConfig(*rc);
1809     delete rc;
1810 
1811     RState rState;
1812     std::string outValue;
1813     rState = rm->GetStringByName("mccmnc_str", outValue);
1814     ASSERT_EQ(SUCCESS, rState);
1815     ASSERT_EQ("str_mcc460_mnc001_en", outValue);
1816 }
1817 
1818 /*
1819  * @tc.name: ResourceManagerGetStringByNameForMccMncTest005
1820  * @tc.desc: Test GetStringByName
1821  * @tc.type: FUNC
1822  */
1823 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest005, TestSize.Level1)
1824 {
1825     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1826     ASSERT_TRUE(ret);
1827 
1828     auto rc = CreateResConfig();
1829     if (rc == nullptr) {
1830         EXPECT_TRUE(false);
1831         return;
1832     }
1833     rc->SetLocaleInfo("en", nullptr, nullptr);
1834     rc->SetMcc(460);
1835     rc->SetMnc(10);
1836     rc->SetDeviceType(DEVICE_TV);
1837     rc->SetColorMode(LIGHT);
1838     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1839     rm->UpdateResConfig(*rc);
1840     delete rc;
1841 
1842     RState rState;
1843     std::string outValue;
1844     rState = rm->GetStringByName("mccmnc_str", outValue);
1845     ASSERT_EQ(SUCCESS, rState);
1846     ASSERT_EQ("str_mcc460_mnc010_en", outValue);
1847 }
1848 
1849 /*
1850  * @tc.name: ResourceManagerGetStringByNameForMccMncTest006
1851  * @tc.desc: Test GetStringByName
1852  * @tc.type: FUNC
1853  */
1854 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest006, TestSize.Level1)
1855 {
1856     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1857     ASSERT_TRUE(ret);
1858 
1859     auto rc = CreateResConfig();
1860     if (rc == nullptr) {
1861         EXPECT_TRUE(false);
1862         return;
1863     }
1864     rc->SetLocaleInfo("en", nullptr, nullptr);
1865     rc->SetMcc(460);
1866     rc->SetMnc(101);
1867     rc->SetDeviceType(DEVICE_TV);
1868     rc->SetColorMode(LIGHT);
1869     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1870     rm->UpdateResConfig(*rc);
1871     delete rc;
1872 
1873     RState rState;
1874     std::string outValue;
1875     rState = rm->GetStringByName("mccmnc_str", outValue);
1876     ASSERT_EQ(SUCCESS, rState);
1877     ASSERT_EQ("str_mcc460_mnc101_en_light", outValue);
1878 }
1879 
1880 /*
1881  * @tc.name: ResourceManagerGetStringByNameForMccMncTest007
1882  * @tc.desc: Test GetStringByName
1883  * @tc.type: FUNC
1884  */
1885 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest007, TestSize.Level1)
1886 {
1887     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1888     ASSERT_TRUE(ret);
1889 
1890     auto rc = CreateResConfig();
1891     if (rc == nullptr) {
1892         EXPECT_TRUE(false);
1893         return;
1894     }
1895     rc->SetLocaleInfo("zh", nullptr, nullptr);
1896     rc->SetMcc(460);
1897     rc->SetMnc(101);
1898     rc->SetDeviceType(DEVICE_TV);
1899     rc->SetColorMode(LIGHT);
1900     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1901     rm->UpdateResConfig(*rc);
1902     delete rc;
1903 
1904     RState rState;
1905     std::string outValue;
1906     rState = rm->GetStringByName("mccmnc_str", outValue);
1907     ASSERT_EQ(SUCCESS, rState);
1908     ASSERT_EQ("str_mcc460_mnc101_zh", outValue);
1909 }
1910 
1911 /*
1912  * @tc.name: ResourceManagerGetStringByNameForMccMncTest008
1913  * @tc.desc: Test GetStringByName
1914  * @tc.type: FUNC
1915  */
1916 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest008, TestSize.Level1)
1917 {
1918     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1919     ASSERT_TRUE(ret);
1920     auto rc = CreateResConfig();
1921     if (rc == nullptr) {
1922         EXPECT_TRUE(false);
1923         return;
1924     }
1925     rc->SetLocaleInfo("en", nullptr, nullptr);
1926     rc->SetDeviceType(DEVICE_PHONE);
1927     rc->SetColorMode(LIGHT);
1928     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1929     rm->UpdateResConfig(*rc);
1930     delete rc;
1931 
1932     RState rState;
1933     std::string outValue;
1934     rState = rm->GetStringByName("mccmnc_str", outValue);
1935     ASSERT_EQ(SUCCESS, rState);
1936     ASSERT_EQ("str_en_us_phone", outValue);
1937 }
1938 
1939 /*
1940  * @tc.name: ResourceManagerGetStringByNameForMccMncTest009
1941  * @tc.desc: Test GetStringByName
1942  * @tc.type: FUNC
1943  */
1944 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest009, TestSize.Level1)
1945 {
1946     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1947     ASSERT_TRUE(ret);
1948     auto rc = CreateResConfig();
1949     if (rc == nullptr) {
1950         EXPECT_TRUE(false);
1951         return;
1952     }
1953     rc->SetLocaleInfo("en", nullptr, nullptr);
1954     rc->SetColorMode(LIGHT);
1955     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1956     rm->UpdateResConfig(*rc);
1957     delete rc;
1958 
1959     RState rState;
1960     std::string outValue;
1961     rState = rm->GetStringByName("mccmnc_str", outValue);
1962     ASSERT_EQ(SUCCESS, rState);
1963     ASSERT_EQ("str_en_us_light", outValue);
1964 }
1965 
1966 /*
1967  * @tc.name: ResourceManagerGetStringByNameForMccMncTest010
1968  * @tc.desc: Test GetStringByName
1969  * @tc.type: FUNC
1970  */
1971 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest010, TestSize.Level1)
1972 {
1973     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
1974     ASSERT_TRUE(ret);
1975     auto rc = CreateResConfig();
1976     if (rc == nullptr) {
1977         EXPECT_TRUE(false);
1978         return;
1979     }
1980     rc->SetLocaleInfo("en", nullptr, nullptr);
1981     rc->SetMcc(460);
1982     rc->SetMnc(101);
1983     rc->SetDeviceType(DEVICE_PHONE);
1984     rc->SetColorMode(LIGHT);
1985     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
1986     rm->UpdateResConfig(*rc);
1987     delete rc;
1988 
1989     RState rState;
1990     std::string outValue;
1991     rState = rm->GetStringByName("mccmnc_str", outValue);
1992     ASSERT_EQ(SUCCESS, rState);
1993     ASSERT_EQ("str_mcc460_mnc101_en_phone", outValue);
1994 }
1995 
1996 /*
1997  * @tc.name: ResourceManagerGetStringByNameForMccMncTest011
1998  * @tc.desc: Test GetStringByName
1999  * @tc.type: FUNC
2000  */
2001 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest011, TestSize.Level1)
2002 {
2003     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2004     ASSERT_TRUE(ret);
2005     auto rc = CreateResConfig();
2006     if (rc == nullptr) {
2007         EXPECT_TRUE(false);
2008         return;
2009     }
2010     rc->SetLocaleInfo("en", nullptr, nullptr);
2011     rc->SetMcc(460);
2012     rc->SetMnc(101);
2013     rc->SetColorMode(LIGHT);
2014     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
2015     rm->UpdateResConfig(*rc);
2016     delete rc;
2017 
2018     RState rState;
2019     std::string outValue;
2020     rState = rm->GetStringByName("mccmnc_str", outValue);
2021     ASSERT_EQ(SUCCESS, rState);
2022     ASSERT_EQ("str_mcc460_mnc101_en_light", outValue);
2023 }
2024 
2025 /*
2026  * @tc.name: ResourceManagerGetStringByNameForMccMncTest012
2027  * @tc.desc: Test GetStringByName
2028  * @tc.type: FUNC
2029  */
2030 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest012, TestSize.Level1)
2031 {
2032     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2033     ASSERT_TRUE(ret);
2034     auto rc = CreateResConfig();
2035     if (rc == nullptr) {
2036         EXPECT_TRUE(false);
2037         return;
2038     }
2039     rc->SetLocaleInfo("en", nullptr, nullptr);
2040     rc->SetDeviceType(DEVICE_TV);
2041     rc->SetColorMode(DARK);
2042     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
2043     rm->UpdateResConfig(*rc);
2044     delete rc;
2045 
2046     RState rState;
2047     std::string outValue;
2048     rState = rm->GetStringByName("mccmnc_str", outValue);
2049     ASSERT_EQ(SUCCESS, rState);
2050     ASSERT_EQ("str_en_us_dark", outValue);
2051 }
2052 
2053 /*
2054  * @tc.name: ResourceManagerGetStringByNameForMccMncTest013
2055  * @tc.desc: Test GetStringByName
2056  * @tc.type: FUNC
2057  */
2058 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest013, TestSize.Level1)
2059 {
2060     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2061     ASSERT_TRUE(ret);
2062     auto rc = CreateResConfig();
2063     if (rc == nullptr) {
2064         EXPECT_TRUE(false);
2065         return;
2066     }
2067     rc->SetLocaleInfo("en", nullptr, nullptr);
2068     rc->SetDeviceType(DEVICE_TV);
2069     rc->SetColorMode(LIGHT);
2070     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
2071     rm->UpdateResConfig(*rc);
2072     delete rc;
2073 
2074     RState rState;
2075     std::string outValue;
2076     rState = rm->GetStringByName("mccmnc_str", outValue);
2077     ASSERT_EQ(SUCCESS, rState);
2078     ASSERT_EQ("str_en_us_light", outValue);
2079 }
2080 
2081 /*
2082  * @tc.name: ResourceManagerGetStringByNameForMccMncTest014
2083  * @tc.desc: Test GetStringByName
2084  * @tc.type: FUNC
2085  */
2086 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest014, TestSize.Level1)
2087 {
2088     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2089     ASSERT_TRUE(ret);
2090     auto rc = CreateResConfig();
2091     if (rc == nullptr) {
2092         EXPECT_TRUE(false);
2093         return;
2094     }
2095     rc->SetLocaleInfo("en", nullptr, nullptr);
2096     rc->SetMcc(460);
2097     rc->SetMnc(101);
2098     rc->SetDeviceType(DEVICE_TV);
2099     rc->SetColorMode(DARK);
2100     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
2101     rm->UpdateResConfig(*rc);
2102     delete rc;
2103 
2104     RState rState;
2105     std::string outValue;
2106     rState = rm->GetStringByName("mccmnc_str", outValue);
2107     ASSERT_EQ(SUCCESS, rState);
2108     ASSERT_EQ("str_mcc460_mnc101_en_dark", outValue);
2109 }
2110 
2111 /*
2112  * @tc.name: ResourceManagerGetStringByNameForMccMncTest015
2113  * @tc.desc: Test GetStringByName
2114  * @tc.type: FUNC
2115  */
2116 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest015, TestSize.Level1)
2117 {
2118     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2119     ASSERT_TRUE(ret);
2120     auto rc = CreateResConfig();
2121     if (rc == nullptr) {
2122         EXPECT_TRUE(false);
2123         return;
2124     }
2125     rc->SetLocaleInfo("en", nullptr, nullptr);
2126     rc->SetMcc(460);
2127     rc->SetMnc(101);
2128     rc->SetDeviceType(DEVICE_TV);
2129     rc->SetColorMode(LIGHT);
2130     rc->SetScreenDensity(SCREEN_DENSITY_SDPI / BASE_DPI);
2131     rm->UpdateResConfig(*rc);
2132     delete rc;
2133 
2134     RState rState;
2135     std::string outValue;
2136     rState = rm->GetStringByName("mccmnc_str", outValue);
2137     ASSERT_EQ(SUCCESS, rState);
2138     ASSERT_EQ("str_mcc460_mnc101_en_light", outValue);
2139 }
2140 
2141 /*
2142  * @tc.name: ResourceManagerGetStringByNameForMccMncTest016
2143  * @tc.desc: Test GetStringByName
2144  * @tc.type: FUNC
2145  */
2146 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest016, TestSize.Level1)
2147 {
2148     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2149     ASSERT_TRUE(ret);
2150     auto rc = CreateResConfig();
2151     if (rc == nullptr) {
2152         EXPECT_TRUE(false);
2153         return;
2154     }
2155     rc->SetLocaleInfo("en", nullptr, nullptr);
2156     rc->SetDeviceType(DEVICE_TV);
2157     rc->SetColorMode(LIGHT);
2158     rc->SetScreenDensity(SCREEN_DENSITY_LDPI / BASE_DPI);
2159     rm->UpdateResConfig(*rc);
2160     delete rc;
2161 
2162     RState rState;
2163     std::string outValue;
2164     rState = rm->GetStringByName("mccmnc_str", outValue);
2165     ASSERT_EQ(SUCCESS, rState);
2166     ASSERT_EQ("str_en_us_light", outValue);
2167 }
2168 
2169 /*
2170  * @tc.name: ResourceManagerGetStringByNameForMccMncTest017
2171  * @tc.desc: Test GetStringByName
2172  * @tc.type: FUNC
2173  */
2174 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest017, TestSize.Level1)
2175 {
2176     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2177     ASSERT_TRUE(ret);
2178     auto rc = CreateResConfig();
2179     if (rc == nullptr) {
2180         EXPECT_TRUE(false);
2181         return;
2182     }
2183     rc->SetLocaleInfo("en", nullptr, nullptr);
2184     rc->SetDeviceType(DEVICE_TV);
2185     rc->SetColorMode(LIGHT);
2186     rc->SetScreenDensity(SCREEN_DENSITY_XLDPI / BASE_DPI);
2187     rm->UpdateResConfig(*rc);
2188     delete rc;
2189 
2190     RState rState;
2191     std::string outValue;
2192     rState = rm->GetStringByName("mccmnc_str", outValue);
2193     ASSERT_EQ(SUCCESS, rState);
2194     ASSERT_EQ("str_en_us_light", outValue);
2195 }
2196 
2197 /*
2198  * @tc.name: ResourceManagerGetStringByNameForMccMncTest018
2199  * @tc.desc: Test GetStringByName
2200  * @tc.type: FUNC
2201  */
2202 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest018, TestSize.Level1)
2203 {
2204     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2205     ASSERT_TRUE(ret);
2206     auto rc = CreateResConfig();
2207     if (rc == nullptr) {
2208         EXPECT_TRUE(false);
2209         return;
2210     }
2211     rc->SetLocaleInfo("en", nullptr, nullptr);
2212     rc->SetMcc(460);
2213     rc->SetMnc(101);
2214     rc->SetDeviceType(DEVICE_TV);
2215     rc->SetColorMode(LIGHT);
2216     rc->SetScreenDensity(SCREEN_DENSITY_LDPI / BASE_DPI);
2217     rm->UpdateResConfig(*rc);
2218     delete rc;
2219 
2220     RState rState;
2221     std::string outValue;
2222     rState = rm->GetStringByName("mccmnc_str", outValue);
2223     ASSERT_EQ(SUCCESS, rState);
2224     ASSERT_EQ("str_mcc460_mnc101_en_light", outValue);
2225 }
2226 
2227 /*
2228  * @tc.name: ResourceManagerGetStringByNameForMccMncTest019
2229  * @tc.desc: Test GetStringByName
2230  * @tc.type: FUNC
2231  */
2232 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest019, TestSize.Level1)
2233 {
2234     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2235     ASSERT_TRUE(ret);
2236     auto rc = CreateResConfig();
2237     if (rc == nullptr) {
2238         EXPECT_TRUE(false);
2239         return;
2240     }
2241     rc->SetLocaleInfo("en", nullptr, nullptr);
2242     rc->SetMcc(460);
2243     rc->SetMnc(101);
2244     rc->SetDeviceType(DEVICE_TV);
2245     rc->SetColorMode(LIGHT);
2246     rc->SetScreenDensity(SCREEN_DENSITY_XLDPI / BASE_DPI);
2247     rm->UpdateResConfig(*rc);
2248     delete rc;
2249 
2250     RState rState;
2251     std::string outValue;
2252     rState = rm->GetStringByName("mccmnc_str", outValue);
2253     ASSERT_EQ(SUCCESS, rState);
2254     ASSERT_EQ("str_mcc460_mnc101_en_light", outValue);
2255 }
2256 
2257 /*
2258  * @tc.name: ResourceManagerGetStringByNameForMccMncTest020
2259  * @tc.desc: Test GetStringByName
2260  * @tc.type: FUNC
2261  */
2262 HWTEST_F(ResourceManagerTestString, ResourceManagerGetStringByNameForMccMncTest020, TestSize.Level1)
2263 {
2264     bool ret = rm->AddResource(FormatFullPath(g_resFilePath).c_str());
2265     ASSERT_TRUE(ret);
2266     auto rc = CreateResConfig();
2267     if (rc == nullptr) {
2268         EXPECT_TRUE(false);
2269         return;
2270     }
2271     rc->SetLocaleInfo("en", nullptr, nullptr);
2272     rc->SetMcc(460);
2273     rc->SetMnc(101);
2274     rc->SetDeviceType(DEVICE_PHONE);
2275     rc->SetColorMode(DARK);
2276     rc->SetScreenDensity(SCREEN_DENSITY_XLDPI / BASE_DPI);
2277     rm->UpdateResConfig(*rc);
2278     delete rc;
2279 
2280     RState rState;
2281     std::string outValue;
2282     rState = rm->GetStringByName("mccmnc_str", outValue);
2283     ASSERT_EQ(SUCCESS, rState);
2284     ASSERT_EQ("str_mcc460_mnc101_en_phone_dark_xldpi", outValue);
2285 }
2286 }
2287