1 /*
2 * Copyright (c) 2021-2022 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 #include "res_config_impl_test.h"
16
17 #include <climits>
18 #include <cstring>
19 #include <gtest/gtest.h>
20
21 #include "res_config_impl.h"
22 #include "test_common.h"
23
24 using namespace OHOS::Global::Resource;
25 using namespace testing::ext;
26 namespace {
27 class ResConfigImplTest : public testing::Test {
28 public:
29 static void SetUpTestCase(void);
30
31 static void TearDownTestCase(void);
32
33 void SetUp();
34
35 void TearDown();
36 };
37
SetUpTestCase(void)38 void ResConfigImplTest::SetUpTestCase(void)
39 {
40 // step 1: input testsuit setup step
41 }
42
TearDownTestCase(void)43 void ResConfigImplTest::TearDownTestCase(void)
44 {
45 // step 2: input testsuit teardown step
46 }
47
SetUp()48 void ResConfigImplTest::SetUp()
49 {
50 }
51
TearDown()52 void ResConfigImplTest::TearDown()
53 {
54 }
55
CreateResConfigImpl(const char * language,const char * script,const char * region)56 ResConfigImpl *CreateResConfigImpl(const char *language, const char *script, const char *region)
57 {
58 ResConfigImpl *resConfigImpl = new ResConfigImpl;
59 resConfigImpl->SetLocaleInfo(language, script, region);
60 return resConfigImpl;
61 }
62
63 /*
64 * @tc.name: ResConfigImplMatchTest001
65 * @tc.desc: Test ResConfig Match
66 * @tc.type: FUNC
67 */
68 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest001, TestSize.Level1)
69 {
70 ResConfigImpl *other = CreateResConfigImpl(nullptr, nullptr, nullptr);
71 ResConfigImpl *current = CreateResConfigImpl("fr", nullptr, "CA");
72 EXPECT_TRUE(current->Match(other));
73 delete current;
74 delete other;
75 };
76
77 /*
78 * @tc.name: ResConfigImplMatchTest002
79 * @tc.desc: Test ResConfig Match
80 * @tc.type: FUNC
81 */
82 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest002, TestSize.Level1)
83 {
84 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "CA");
85 ResConfigImpl *current = CreateResConfigImpl("fr", nullptr, "CA");
86 EXPECT_FALSE(current->Match(other));
87 delete current;
88 delete other;
89 };
90
91 /*
92 * @tc.name: ResConfigImplMatchTest003
93 * @tc.desc: Test ResConfig Match
94 * @tc.type: FUNC
95 */
96 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest003, TestSize.Level1)
97 {
98 ResConfigImpl *other = CreateResConfigImpl("tl", nullptr, "PH");
99 ResConfigImpl *current = CreateResConfigImpl("fil", nullptr, "PH");
100 EXPECT_TRUE(current->Match(other));
101 delete current;
102 delete other;
103 };
104
105 /*
106 * @tc.name: ResConfigImplMatchTest004
107 * @tc.desc: Test ResConfig Match
108 * @tc.type: FUNC
109 */
110 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest004, TestSize.Level1)
111 {
112 ResConfigImpl *other = CreateResConfigImpl("qaa", nullptr, nullptr);
113 ResConfigImpl *current = CreateResConfigImpl("qaa", nullptr, "CA");
114 EXPECT_TRUE(current->Match(other));
115 delete current;
116 delete other;
117 };
118
119 /*
120 * @tc.name: ResConfigImplMatchTest005
121 * @tc.desc: Test ResConfig Match
122 * @tc.type: FUNC
123 */
124 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest005, TestSize.Level1)
125 {
126 ResConfigImpl *other = CreateResConfigImpl("qaa", nullptr, "CA");
127 ResConfigImpl *current = CreateResConfigImpl("qaa", nullptr, "CA");
128 EXPECT_TRUE(current->Match(other));
129 delete current;
130 delete other;
131 };
132
133 /*
134 * @tc.name: ResConfigImplMatchTest006
135 * @tc.desc: Test ResConfig Match
136 * @tc.type: FUNC
137 */
138 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest006, TestSize.Level1)
139 {
140 ResConfigImpl *other = CreateResConfigImpl("az", nullptr, nullptr);
141 ResConfigImpl *current = CreateResConfigImpl("az", "Latn", nullptr);
142 EXPECT_TRUE(current->Match(other));
143 delete current;
144 delete other;
145 };
146
147 /*
148 * @tc.name: ResConfigImplMatchTest007
149 * @tc.desc: Test ResConfig Match
150 * @tc.type: FUNC
151 */
152 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest007, TestSize.Level1)
153 {
154 ResConfigImpl *other = CreateResConfigImpl("az", nullptr, "IR");
155 ResConfigImpl *current = CreateResConfigImpl("az", "Arab", nullptr);
156 EXPECT_TRUE(current->Match(other));
157 delete current;
158 delete other;
159 };
160
161 /*
162 * @tc.name: ResConfigImplMatchTest008
163 * @tc.desc: Test ResConfig Match
164 * @tc.type: FUNC
165 */
166 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest008, TestSize.Level1)
167 {
168 ResConfigImpl *other = CreateResConfigImpl("ar", nullptr, "EG");
169 ResConfigImpl *current = CreateResConfigImpl("ar", nullptr, "TN");
170 EXPECT_TRUE(current->Match(other));
171 delete current;
172 delete other;
173 };
174
175 /*
176 * @tc.name: ResConfigImplMatchTest009
177 * @tc.desc: Test ResConfig Match
178 * @tc.type: FUNC
179 */
180 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest009, TestSize.Level1)
181 {
182 ResConfigImpl *other = CreateResConfigImpl("qaa", "Latn", "FR");
183 ResConfigImpl *current = CreateResConfigImpl("qaa", nullptr, "CA");
184 EXPECT_FALSE(current->Match(other));
185 delete current;
186 delete other;
187 };
188
189 /*
190 * @tc.name: ResConfigImplMatchTest010
191 * @tc.desc: Test ResConfig Match
192 * @tc.type: FUNC
193 */
194 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest010, TestSize.Level1)
195 {
196 ResConfigImpl *other = CreateResConfigImpl("qaa", nullptr, "FR");
197 ResConfigImpl *current = CreateResConfigImpl("qaa", "Latn", "CA");
198 EXPECT_FALSE(current->Match(other));
199 delete current;
200 delete other;
201 };
202
203 /*
204 * @tc.name: ResConfigImplMatchTest011
205 * @tc.desc: Test ResConfig Match
206 * @tc.type: FUNC
207 */
208 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest011, TestSize.Level1)
209 {
210 ResConfigImpl *other = CreateResConfigImpl("az", nullptr, nullptr);
211 ResConfigImpl *current = CreateResConfigImpl("az", "Cyrl", nullptr);
212 EXPECT_FALSE(current->Match(other));
213 delete current;
214 delete other;
215 };
216
217 /*
218 * @tc.name: ResConfigImplMatchTest012
219 * @tc.desc: Test ResConfig Match
220 * @tc.type: FUNC
221 */
222 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest012, TestSize.Level1)
223 {
224 ResConfigImpl *other = CreateResConfigImpl("az", nullptr, nullptr);
225 ResConfigImpl *current = CreateResConfigImpl("az", nullptr, "IR");
226 EXPECT_FALSE(current->Match(other));
227 delete current;
228 delete other;
229 };
230
231 /*
232 * @tc.name: ResConfigImplMatchTest013
233 * @tc.desc: Test ResConfig Match
234 * @tc.type: FUNC
235 */
236 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest013, TestSize.Level1)
237 {
238 ResConfigImpl *other = CreateResConfigImpl("qaa", nullptr, "FR");
239 ResConfigImpl *current = CreateResConfigImpl("qaa", nullptr, "CA");
240 EXPECT_FALSE(current->Match(other));
241 delete current;
242 delete other;
243 };
244
245 /*
246 * @tc.name: ResConfigImplMatchTest014
247 * @tc.desc: Test ResConfig Match
248 * @tc.type: FUNC
249 */
250 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest014, TestSize.Level1)
251 {
252 ResConfigImpl *other = CreateResConfigImpl("he", nullptr, nullptr);
253 ResConfigImpl *current = CreateResConfigImpl("iw", nullptr, nullptr);
254 EXPECT_TRUE(current->Match(other));
255 EXPECT_TRUE(other->Match(current));
256 delete current;
257 delete other;
258 };
259
260 /*
261 * @tc.name: ResConfigImplMatchTest015
262 * @tc.desc: Test ResConfig Match
263 * @tc.type: FUNC
264 */
265 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest015, TestSize.Level1)
266 {
267 ResConfigImpl *other = CreateResConfigImpl("ji", nullptr, nullptr);
268 ResConfigImpl *current = CreateResConfigImpl("yi", nullptr, nullptr);
269 EXPECT_TRUE(current->Match(other));
270 EXPECT_TRUE(other->Match(current));
271 delete current;
272 delete other;
273 };
274
275 /*
276 * @tc.name: ResConfigImplMatchTest016
277 * @tc.desc: Test ResConfig Match
278 * @tc.type: FUNC
279 */
280 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest016, TestSize.Level1)
281 {
282 ResConfigImpl *other = CreateResConfigImpl("jw", nullptr, nullptr);
283 ResConfigImpl *current = CreateResConfigImpl("jv", nullptr, nullptr);
284 EXPECT_TRUE(current->Match(other));
285 EXPECT_TRUE(other->Match(current));
286 delete current;
287 delete other;
288 };
289
290 /*
291 * @tc.name: ResConfigImplMatchTest017
292 * @tc.desc: Test ResConfig Match
293 * @tc.type: FUNC
294 */
295 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest017, TestSize.Level1)
296 {
297 ResConfigImpl *other = CreateResConfigImpl("in", nullptr, nullptr);
298 ResConfigImpl *current = CreateResConfigImpl("id", nullptr, nullptr);
299 EXPECT_TRUE(current->Match(other));
300 EXPECT_TRUE(other->Match(current));
301 delete current;
302 delete other;
303 };
304
305 /*
306 * @tc.name: ResConfigImplMatchTest018
307 * @tc.desc: Test ResConfig Match
308 * @tc.type: FUNC
309 */
310 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest018, TestSize.Level1)
311 {
312 ResConfigImpl *other = CreateResConfigImpl("en", "Latn", nullptr);
313 ResConfigImpl *current = CreateResConfigImpl("en", "Qaag", nullptr);
314 EXPECT_TRUE(current->Match(other));
315 delete current;
316 delete other;
317 };
318
319 /*
320 * @tc.name: ResConfigImplMatchTest019
321 * @tc.desc: Test ResConfig Match
322 * @tc.type: FUNC
323 */
324 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest019, TestSize.Level1)
325 {
326 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
327 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
328 current->SetDeviceType(DeviceType::DEVICE_CAR);
329 other->SetDeviceType(DeviceType::DEVICE_CAR);
330 EXPECT_TRUE(current->Match(other));
331 delete current;
332 delete other;
333 };
334
335 /*
336 * @tc.name: ResConfigImplMatchTest020
337 * @tc.desc: Test ResConfig Match
338 * @tc.type: FUNC
339 */
340 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest020, TestSize.Level1)
341 {
342 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
343 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
344 current->SetDeviceType(DeviceType::DEVICE_CAR);
345 other->SetDeviceType(DeviceType::DEVICE_PAD);
346 EXPECT_FALSE(current->Match(other));
347 delete current;
348 delete other;
349 };
350
351 /*
352 * @tc.name: ResConfigImplMatchTest021
353 * @tc.desc: Test ResConfig Match
354 * @tc.type: FUNC
355 */
356 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest021, TestSize.Level1)
357 {
358 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
359 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
360 other->SetDeviceType(DeviceType::DEVICE_PAD);
361 EXPECT_TRUE(current->Match(other));
362 delete current;
363 delete other;
364 };
365
366 /*
367 * @tc.name: ResConfigImplMatchTest022
368 * @tc.desc: Test ResConfig Match
369 * @tc.type: FUNC
370 */
371 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest022, TestSize.Level1)
372 {
373 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
374 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
375 current->SetDeviceType(DeviceType::DEVICE_PAD);
376 EXPECT_TRUE(current->Match(other));
377 delete current;
378 delete other;
379 };
380
381 /*
382 * @tc.name: ResConfigImplMatchTest023
383 * @tc.desc: Test ResConfig Match
384 * @tc.type: FUNC
385 */
386 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest023, TestSize.Level1)
387 {
388 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
389 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
390 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
391 other->SetDirection(Direction::DIRECTION_HORIZONTAL);
392 EXPECT_TRUE(current->Match(other));
393 delete current;
394 delete other;
395 };
396
397 /*
398 * @tc.name: ResConfigImplMatchTest024
399 * @tc.desc: Test ResConfig Match
400 * @tc.type: FUNC
401 */
402 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest024, TestSize.Level1)
403 {
404 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
405 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
406 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
407 other->SetDirection(Direction::DIRECTION_VERTICAL);
408 EXPECT_FALSE(current->Match(other));
409 delete current;
410 delete other;
411 };
412
413 /*
414 * @tc.name: ResConfigImplMatchTest025
415 * @tc.desc: Test ResConfig Match
416 * @tc.type: FUNC
417 */
418 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest025, TestSize.Level1)
419 {
420 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
421 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
422 other->SetDirection(Direction::DIRECTION_HORIZONTAL);
423 EXPECT_TRUE(current->Match(other));
424 delete current;
425 delete other;
426 };
427
428 /*
429 * @tc.name: ResConfigImplMatchTest026
430 * @tc.desc: Test ResConfig Match
431 * @tc.type: FUNC
432 */
433 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest026, TestSize.Level1)
434 {
435 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
436 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
437 current->SetDirection(Direction::DIRECTION_VERTICAL);
438 EXPECT_TRUE(current->Match(other));
439 delete current;
440 delete other;
441 };
442
443 /*
444 * @tc.name: ResConfigImplMatchTest027
445 * @tc.desc: Test ResConfig Match
446 * @tc.type: FUNC
447 */
448 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest027, TestSize.Level1)
449 {
450 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
451 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
452 current->SetDirection(Direction::DIRECTION_VERTICAL);
453 current->SetDeviceType(DeviceType::DEVICE_PHONE);
454 other->SetDirection(Direction::DIRECTION_VERTICAL);
455 other->SetDeviceType(DeviceType::DEVICE_PHONE);
456 EXPECT_TRUE(current->Match(other));
457 delete current;
458 delete other;
459 };
460
461 /*
462 * @tc.name: ResConfigImplMatchTest028
463 * @tc.desc: Test ResConfig Match
464 * @tc.type: FUNC
465 */
466 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest028, TestSize.Level1)
467 {
468 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
469 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
470 current->SetDirection(Direction::DIRECTION_VERTICAL);
471 current->SetDeviceType(DeviceType::DEVICE_PHONE);
472 other->SetDeviceType(DeviceType::DEVICE_PHONE);
473 EXPECT_TRUE(current->Match(other));
474 delete current;
475 delete other;
476 };
477
478 /*
479 * @tc.name: ResConfigImplMatchTest029
480 * @tc.desc: Test ResConfig Match
481 * @tc.type: FUNC
482 */
483 HWTEST_F(ResConfigImplTest, ResConfigImplMatchTest029, TestSize.Level1)
484 {
485 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
486 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
487 current->SetDirection(Direction::DIRECTION_VERTICAL);
488 current->SetDeviceType(DeviceType::DEVICE_PHONE);
489 other->SetDeviceType(DeviceType::DEVICE_PHONE);
490 other->SetDirection(Direction::DIRECTION_HORIZONTAL);
491 EXPECT_FALSE(current->Match(other));
492 delete current;
493 delete other;
494 };
495
496 /*
497 * @tc.name: ResConfigImplIsMoreSuitableTest001
498 * @tc.desc: Test ResConfig IsMoreSuitable
499 * @tc.type: FUNC
500 */
501 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest001, TestSize.Level1)
502 {
503 ResConfigImpl *request = CreateResConfigImpl(nullptr, nullptr, nullptr);
504 ResConfigImpl *current = CreateResConfigImpl("fr", nullptr, "FR");
505 ResConfigImpl *other = CreateResConfigImpl("fr", nullptr, "CA");
506 EXPECT_TRUE(current->IsMoreSuitable(other, request));
507 EXPECT_TRUE(other->IsMoreSuitable(current, request));
508 delete request;
509 delete current;
510 delete other;
511 }
512
513 /*
514 * @tc.name: ResConfigImplIsMoreSuitableTest002
515 * @tc.desc: Test ResConfig IsMoreSuitable
516 * @tc.type: FUNC
517 */
518 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest002, TestSize.Level1)
519 {
520 ResConfigImpl *request = CreateResConfigImpl("fr", nullptr, "CA");
521 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
522 ResConfigImpl *other = CreateResConfigImpl(nullptr, nullptr, nullptr);
523 EXPECT_TRUE(current->IsMoreSuitable(other, request));
524 EXPECT_TRUE(other->IsMoreSuitable(current, request));
525 delete request;
526 delete current;
527 delete other;
528 }
529
530 /*
531 * @tc.name: ResConfigImplIsMoreSuitableTest003
532 * @tc.desc: Test ResConfig IsMoreSuitable
533 * @tc.type: FUNC
534 */
535 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest003, TestSize.Level1)
536 {
537 ResConfigImpl *request = CreateResConfigImpl("fr", nullptr, "CA");
538 ResConfigImpl *current = CreateResConfigImpl("fr", nullptr, "FR");
539 ResConfigImpl *other = CreateResConfigImpl(nullptr, nullptr, nullptr);
540 EXPECT_TRUE(current->IsMoreSuitable(other, request));
541 EXPECT_FALSE(other->IsMoreSuitable(current, request));
542 delete request;
543 delete current;
544 delete other;
545 }
546
547 /*
548 * @tc.name: ResConfigImplIsMoreSuitableTest004
549 * @tc.desc: Test ResConfig IsMoreSuitable
550 * @tc.type: FUNC
551 */
552 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest004, TestSize.Level1)
553 {
554 ResConfigImpl *request = CreateResConfigImpl("fil", nullptr, "PH");
555 ResConfigImpl *current = CreateResConfigImpl("tl", nullptr, "PH");
556 ResConfigImpl *other = CreateResConfigImpl("fil", nullptr, "US");
557 EXPECT_TRUE(current->IsMoreSuitable(other, request));
558 EXPECT_FALSE(other->IsMoreSuitable(current, request));
559 delete request;
560 delete current;
561 delete other;
562 }
563
564 /*
565 * @tc.name: ResConfigImplIsMoreSuitableTest005
566 * @tc.desc: Test ResConfig IsMoreSuitable
567 * @tc.type: FUNC
568 */
569 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest005, TestSize.Level1)
570 {
571 ResConfigImpl *request = CreateResConfigImpl("fil", nullptr, "PH");
572 ResConfigImpl *current = CreateResConfigImpl("fil", nullptr, "PH");
573 ResConfigImpl *other = CreateResConfigImpl("tl", nullptr, "PH");
574 EXPECT_TRUE(current->IsMoreSuitable(other, request));
575 EXPECT_FALSE(other->IsMoreSuitable(current, request));
576 delete request;
577 delete current;
578 delete other;
579 }
580
581 /*
582 * @tc.name: ResConfigImplIsMoreSuitableTest006
583 * @tc.desc: Test ResConfig IsMoreSuitable
584 * @tc.type: FUNC
585 */
586 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest006, TestSize.Level1)
587 {
588 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
589 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "419");
590 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "419");
591 EXPECT_TRUE(current->IsMoreSuitable(other, request));
592 EXPECT_TRUE(other->IsMoreSuitable(current, request));
593 delete request;
594 delete current;
595 delete other;
596 }
597
598 /*
599 * @tc.name: ResConfigImplIsMoreSuitableTest007
600 * @tc.desc: Test ResConfig IsMoreSuitable
601 * @tc.type: FUNC
602 */
603 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest007, TestSize.Level1)
604 {
605 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
606 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "AR");
607 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "419");
608 EXPECT_TRUE(current->IsMoreSuitable(other, request));
609 EXPECT_FALSE(other->IsMoreSuitable(current, request));
610 delete request;
611 delete current;
612 delete other;
613 }
614
615 /*
616 * @tc.name: ResConfigImplIsMoreSuitableTest008
617 * @tc.desc: Test ResConfig IsMoreSuitable
618 * @tc.type: FUNC
619 */
620 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest008, TestSize.Level1)
621 {
622 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
623 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "419");
624 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, nullptr);
625 EXPECT_TRUE(current->IsMoreSuitable(other, request));
626 EXPECT_FALSE(other->IsMoreSuitable(current, request));
627 delete request;
628 delete current;
629 delete other;
630 }
631
632 /*
633 * @tc.name: ResConfigImplIsMoreSuitableTest009
634 * @tc.desc: Test ResConfig IsMoreSuitable
635 * @tc.type: FUNC
636 */
637 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest009, TestSize.Level1)
638 {
639 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
640 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "419");
641 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "ES");
642 EXPECT_TRUE(current->IsMoreSuitable(other, request));
643 EXPECT_FALSE(other->IsMoreSuitable(current, request));
644 delete request;
645 delete current;
646 delete other;
647 }
648
649 /*
650 * @tc.name: ResConfigImplIsMoreSuitableTest010
651 * @tc.desc: Test ResConfig IsMoreSuitable
652 * @tc.type: FUNC
653 */
654 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest010, TestSize.Level1)
655 {
656 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
657 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, nullptr);
658 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "ES");
659 EXPECT_TRUE(current->IsMoreSuitable(other, request));
660 EXPECT_FALSE(other->IsMoreSuitable(current, request));
661 delete request;
662 delete current;
663 delete other;
664 }
665
666 /*
667 * @tc.name: ResConfigImplIsMoreSuitableTest011
668 * @tc.desc: Test ResConfig IsMoreSuitable
669 * @tc.type: FUNC
670 */
671 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest011, TestSize.Level1)
672 {
673 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
674 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "PE");
675 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "ES");
676 EXPECT_TRUE(current->IsMoreSuitable(other, request));
677 EXPECT_FALSE(other->IsMoreSuitable(current, request));
678 delete request;
679 delete current;
680 delete other;
681 }
682
683 /*
684 * @tc.name: ResConfigImplIsMoreSuitableTest012
685 * @tc.desc: Test ResConfig IsMoreSuitable
686 * @tc.type: FUNC
687 */
688 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest012, TestSize.Level1)
689 {
690 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
691 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "AR");
692 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, nullptr);
693 EXPECT_TRUE(current->IsMoreSuitable(other, request));
694 EXPECT_FALSE(other->IsMoreSuitable(current, request));
695 delete request;
696 delete current;
697 delete other;
698 }
699
700 /*
701 * @tc.name: ResConfigImplIsMoreSuitableTest013
702 * @tc.desc: Test ResConfig IsMoreSuitable
703 * @tc.type: FUNC
704 */
705 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest013, TestSize.Level1)
706 {
707 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "AR");
708 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "US");
709 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "BO");
710 EXPECT_TRUE(current->IsMoreSuitable(other, request));
711 EXPECT_FALSE(other->IsMoreSuitable(current, request));
712 delete request;
713 delete current;
714 delete other;
715 }
716
717 /*
718 * @tc.name: ResConfigImplIsMoreSuitableTest014
719 * @tc.desc: Test ResConfig IsMoreSuitable
720 * @tc.type: FUNC
721 */
722 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest014, TestSize.Level1)
723 {
724 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "IC");
725 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "ES");
726 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "GQ");
727 EXPECT_TRUE(current->IsMoreSuitable(other, request));
728 EXPECT_FALSE(other->IsMoreSuitable(current, request));
729 delete request;
730 delete current;
731 delete other;
732 }
733
734 /*
735 * @tc.name: ResConfigImplIsMoreSuitableTest015
736 * @tc.desc: Test ResConfig IsMoreSuitable
737 * @tc.type: FUNC
738 */
739 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest015, TestSize.Level1)
740 {
741 ResConfigImpl *request = CreateResConfigImpl("es", nullptr, "GQ");
742 ResConfigImpl *current = CreateResConfigImpl("es", nullptr, "IC");
743 ResConfigImpl *other = CreateResConfigImpl("es", nullptr, "419");
744 EXPECT_TRUE(current->IsMoreSuitable(other, request));
745 EXPECT_FALSE(other->IsMoreSuitable(current, request));
746 delete request;
747 delete current;
748 delete other;
749 }
750
751 /*
752 * @tc.name: ResConfigImplIsMoreSuitableTest016
753 * @tc.desc: Test ResConfig IsMoreSuitable
754 * @tc.type: FUNC
755 */
756 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest016, TestSize.Level1)
757 {
758 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "GB");
759 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "001");
760 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, nullptr);
761 EXPECT_TRUE(current->IsMoreSuitable(other, request));
762 EXPECT_FALSE(other->IsMoreSuitable(current, request));
763 delete request;
764 delete current;
765 delete other;
766 }
767
768 /*
769 * @tc.name: ResConfigImplIsMoreSuitableTest017
770 * @tc.desc: Test ResConfig IsMoreSuitable
771 * @tc.type: FUNC
772 */
773 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest017, TestSize.Level1)
774 {
775 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "PR");
776 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
777 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "001");
778 EXPECT_TRUE(current->IsMoreSuitable(other, request));
779 EXPECT_FALSE(other->IsMoreSuitable(current, request));
780 delete request;
781 delete current;
782 delete other;
783 }
784
785 /*
786 * @tc.name: ResConfigImplIsMoreSuitableTest018
787 * @tc.desc: Test ResConfig IsMoreSuitable
788 * @tc.type: FUNC
789 */
790 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest018, TestSize.Level1)
791 {
792 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "DE");
793 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "150");
794 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "001");
795 EXPECT_TRUE(current->IsMoreSuitable(other, request));
796 EXPECT_FALSE(other->IsMoreSuitable(current, request));
797 delete request;
798 delete current;
799 delete other;
800 }
801
802 /*
803 * @tc.name: ResConfigImplIsMoreSuitableTest019
804 * @tc.desc: Test ResConfig IsMoreSuitable
805 * @tc.type: FUNC
806 */
807 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest019, TestSize.Level1)
808 {
809 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "IN");
810 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "AU");
811 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
812 EXPECT_TRUE(current->IsMoreSuitable(other, request));
813 EXPECT_FALSE(other->IsMoreSuitable(current, request));
814 delete request;
815 delete current;
816 delete other;
817 }
818
819 /*
820 * @tc.name: ResConfigImplIsMoreSuitableTest020
821 * @tc.desc: Test ResConfig IsMoreSuitable
822 * @tc.type: FUNC
823 */
824 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest020, TestSize.Level1)
825 {
826 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "PR");
827 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "001");
828 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "GB");
829 EXPECT_TRUE(current->IsMoreSuitable(other, request));
830 EXPECT_FALSE(other->IsMoreSuitable(current, request));
831 delete request;
832 delete current;
833 delete other;
834 }
835
836 /*
837 * @tc.name: ResConfigImplIsMoreSuitableTest021
838 * @tc.desc: Test ResConfig IsMoreSuitable
839 * @tc.type: FUNC
840 */
841 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest021, TestSize.Level1)
842 {
843 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "IN");
844 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "GB");
845 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "AU");
846 EXPECT_TRUE(current->IsMoreSuitable(other, request));
847 EXPECT_FALSE(other->IsMoreSuitable(current, request));
848 delete request;
849 delete current;
850 delete other;
851 }
852
853 /*
854 * @tc.name: ResConfigImplIsMoreSuitableTest022
855 * @tc.desc: Test ResConfig IsMoreSuitable
856 * @tc.type: FUNC
857 */
858 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest022, TestSize.Level1)
859 {
860 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "IN");
861 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "AU");
862 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "CA");
863 EXPECT_TRUE(current->IsMoreSuitable(other, request));
864 EXPECT_FALSE(other->IsMoreSuitable(current, request));
865 delete request;
866 delete current;
867 delete other;
868 }
869
870 /*
871 * @tc.name: ResConfigImplIsMoreSuitableTest023
872 * @tc.desc: Test ResConfig IsMoreSuitable
873 * @tc.type: FUNC
874 */
875 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest023, TestSize.Level1)
876 {
877 ResConfigImpl *request = CreateResConfigImpl("pt", nullptr, "MZ");
878 ResConfigImpl *current = CreateResConfigImpl("pt", nullptr, "PT");
879 ResConfigImpl *other = CreateResConfigImpl("pt", nullptr, nullptr);
880 EXPECT_TRUE(current->IsMoreSuitable(other, request));
881 EXPECT_FALSE(other->IsMoreSuitable(current, request));
882 delete request;
883 delete current;
884 delete other;
885 }
886
887 /*
888 * @tc.name: ResConfigImplIsMoreSuitableTest024
889 * @tc.desc: Test ResConfig IsMoreSuitable
890 * @tc.type: FUNC
891 */
892 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest024, TestSize.Level1)
893 {
894 ResConfigImpl *request = CreateResConfigImpl("pt", nullptr, "MZ");
895 ResConfigImpl *current = CreateResConfigImpl("pt", nullptr, "PT");
896 ResConfigImpl *other = CreateResConfigImpl("pt", nullptr, "BR");
897 EXPECT_TRUE(current->IsMoreSuitable(other, request));
898 EXPECT_FALSE(other->IsMoreSuitable(current, request));
899 delete request;
900 delete current;
901 delete other;
902 }
903
904 /*
905 * @tc.name: ResConfigImplIsMoreSuitableTest025
906 * @tc.desc: Test ResConfig IsMoreSuitable
907 * @tc.type: FUNC
908 */
909 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest025, TestSize.Level1)
910 {
911 ResConfigImpl *request = CreateResConfigImpl("zh", "Hant", "MO");
912 ResConfigImpl *current = CreateResConfigImpl("zh", "Hant", "HK");
913 ResConfigImpl *other = CreateResConfigImpl("zh", "Hant", "TW");
914 EXPECT_TRUE(current->IsMoreSuitable(other, request));
915 EXPECT_FALSE(other->IsMoreSuitable(current, request));
916 delete request;
917 delete current;
918 delete other;
919 }
920
921 /*
922 * @tc.name: ResConfigImplIsMoreSuitableTest026
923 * @tc.desc: Test ResConfig IsMoreSuitable
924 * @tc.type: FUNC
925 */
926 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest026, TestSize.Level1)
927 {
928 ResConfigImpl *request = CreateResConfigImpl("zh", "Hant", "US");
929 ResConfigImpl *current = CreateResConfigImpl("zh", "Hant", "TW");
930 ResConfigImpl *other = CreateResConfigImpl("zh", "Hant", "HK");
931 EXPECT_TRUE(current->IsMoreSuitable(other, request));
932 EXPECT_FALSE(other->IsMoreSuitable(current, request));
933 delete request;
934 delete current;
935 delete other;
936 }
937
938 /*
939 * @tc.name: ResConfigImplIsMoreSuitableTest027
940 * @tc.desc: Test ResConfig IsMoreSuitable
941 * @tc.type: FUNC
942 */
943 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest027, TestSize.Level1)
944 {
945 ResConfigImpl *request = CreateResConfigImpl("ar", nullptr, "DZ");
946 ResConfigImpl *current = CreateResConfigImpl("ar", nullptr, "015");
947 ResConfigImpl *other = CreateResConfigImpl("ar", nullptr, nullptr);
948 EXPECT_TRUE(current->IsMoreSuitable(other, request));
949 EXPECT_FALSE(other->IsMoreSuitable(current, request));
950 delete request;
951 delete current;
952 delete other;
953 }
954
955 /*
956 * @tc.name: ResConfigImplIsMoreSuitableTest028
957 * @tc.desc: Test ResConfig IsMoreSuitable
958 * @tc.type: FUNC
959 */
960 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest028, TestSize.Level1)
961 {
962 ResConfigImpl *request = CreateResConfigImpl("ar", nullptr, "EG");
963 ResConfigImpl *current = CreateResConfigImpl("ar", nullptr, nullptr);
964 ResConfigImpl *other = CreateResConfigImpl("ar", nullptr, "015");
965 EXPECT_TRUE(current->IsMoreSuitable(other, request));
966 EXPECT_FALSE(other->IsMoreSuitable(current, request));
967 delete request;
968 delete current;
969 delete other;
970 }
971
972 /*
973 * @tc.name: ResConfigImplIsMoreSuitableTest029
974 * @tc.desc: Test ResConfig IsMoreSuitable
975 * @tc.type: FUNC
976 */
977 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest029, TestSize.Level1)
978 {
979 ResConfigImpl *request = CreateResConfigImpl("ar", nullptr, "QA");
980 ResConfigImpl *current = CreateResConfigImpl("ar", nullptr, "EG");
981 ResConfigImpl *other = CreateResConfigImpl("ar", nullptr, "BH");
982 EXPECT_TRUE(current->IsMoreSuitable(other, request));
983 EXPECT_FALSE(other->IsMoreSuitable(current, request));
984 delete request;
985 delete current;
986 delete other;
987 }
988
989 /*
990 * @tc.name: ResConfigImplIsMoreSuitableTest030
991 * @tc.desc: Test ResConfig IsMoreSuitable
992 * @tc.type: FUNC
993 */
994 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest030, TestSize.Level1)
995 {
996 ResConfigImpl *request = CreateResConfigImpl("ar", nullptr, "QA");
997 ResConfigImpl *current = CreateResConfigImpl("ar", nullptr, "SA");
998 ResConfigImpl *other = CreateResConfigImpl("ar", nullptr, "015");
999 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1000 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1001 delete request;
1002 delete current;
1003 delete other;
1004 }
1005
1006 /*
1007 * @tc.name: ResConfigImplIsMoreSuitableTest031
1008 * @tc.desc: Test ResConfig IsMoreSuitable
1009 * @tc.type: FUNC
1010 */
1011 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest031, TestSize.Level1)
1012 {
1013 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1014 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
1015 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "001");
1016 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1017 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1018 delete request;
1019 delete current;
1020 delete other;
1021 }
1022
1023 /*
1024 * @tc.name: ResConfigImplIsMoreSuitableTest032
1025 * @tc.desc: Test ResConfig IsMoreSuitable
1026 * @tc.type: FUNC
1027 */
1028 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest032, TestSize.Level1)
1029 {
1030 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1031 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
1032 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "GB");
1033 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1034 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1035 delete request;
1036 delete current;
1037 delete other;
1038 }
1039
1040 /*
1041 * @tc.name: ResConfigImplIsMoreSuitableTest033
1042 * @tc.desc: Test ResConfig IsMoreSuitable
1043 * @tc.type: FUNC
1044 */
1045 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest033, TestSize.Level1)
1046 {
1047 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "PR");
1048 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
1049 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "001");
1050 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1051 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1052 delete request;
1053 delete current;
1054 delete other;
1055 }
1056
1057 /*
1058 * @tc.name: ResConfigImplIsMoreSuitableTest034
1059 * @tc.desc: Test ResConfig IsMoreSuitable
1060 * @tc.type: FUNC
1061 */
1062 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest034, TestSize.Level1)
1063 {
1064 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1065 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
1066 ResConfigImpl *other = CreateResConfigImpl(nullptr, nullptr, nullptr);
1067 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1068 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1069 delete request;
1070 delete current;
1071 delete other;
1072 }
1073
1074 /*
1075 * @tc.name: ResConfigImplIsMoreSuitableTest035
1076 * @tc.desc: Test ResConfig IsMoreSuitable
1077 * @tc.type: FUNC
1078 */
1079 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest035, TestSize.Level1)
1080 {
1081 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "PR");
1082 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, nullptr);
1083 ResConfigImpl *other = CreateResConfigImpl(nullptr, nullptr, nullptr);
1084 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1085 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1086 delete request;
1087 delete current;
1088 delete other;
1089 }
1090
1091 /*
1092 * @tc.name: ResConfigImplIsMoreSuitableTest036
1093 * @tc.desc: Test ResConfig IsMoreSuitable
1094 * @tc.type: FUNC
1095 */
1096 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest036, TestSize.Level1)
1097 {
1098 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1099 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
1100 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "PR");
1101 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1102 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1103 delete request;
1104 delete current;
1105 delete other;
1106 }
1107
1108 /*
1109 * @tc.name: ResConfigImplIsMoreSuitableTest037
1110 * @tc.desc: Test ResConfig IsMoreSuitable
1111 * @tc.type: FUNC
1112 */
1113 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest037, TestSize.Level1)
1114 {
1115 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "CN");
1116 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
1117 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "GB");
1118 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1119 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1120 delete request;
1121 delete current;
1122 delete other;
1123 }
1124
1125 /*
1126 * @tc.name: ResConfigImplIsMoreSuitableTest038
1127 * @tc.desc: Test ResConfig IsMoreSuitable
1128 * @tc.type: FUNC
1129 */
1130 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest038, TestSize.Level1)
1131 {
1132 ResConfigImpl *request = CreateResConfigImpl("en", "Qaag", nullptr);
1133 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "GB");
1134 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "CA");
1135 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1136 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1137 delete request;
1138 delete current;
1139 delete other;
1140 }
1141
1142 /*
1143 * @tc.name: ResConfigImplIsMoreSuitableTest039
1144 * @tc.desc: Test ResConfig IsMoreSuitable
1145 * @tc.type: FUNC
1146 */
1147 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest039, TestSize.Level1)
1148 {
1149 ResConfigImpl *request = CreateResConfigImpl("en", "Qaag", nullptr);
1150 ResConfigImpl *current = CreateResConfigImpl(nullptr, nullptr, nullptr);
1151 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "CA");
1152 EXPECT_FALSE(current->IsMoreSuitable(other, request));
1153 EXPECT_TRUE(other->IsMoreSuitable(current, request));
1154 delete request;
1155 delete current;
1156 delete other;
1157 }
1158
1159 /*
1160 * @tc.name: ResConfigImplIsMoreSuitableTest040
1161 * @tc.desc: Test ResConfig IsMoreSuitable
1162 * @tc.type: FUNC
1163 */
1164 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest040, TestSize.Level1)
1165 {
1166 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1167 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "CN");
1168 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "GB");
1169 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1170 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1171 delete request;
1172 delete current;
1173 delete other;
1174 }
1175
1176 /*
1177 * @tc.name: ResConfigImplIsMoreSuitableTest041
1178 * @tc.desc: Test ResConfig IsMoreSuitable
1179 * @tc.type: FUNC
1180 */
1181 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest041, TestSize.Level1)
1182 {
1183 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1184 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1185 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1186 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1187 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1188 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1189 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1190 delete request;
1191 delete current;
1192 delete other;
1193 }
1194
1195 /*
1196 * @tc.name: ResConfigImplIsMoreSuitableTest042
1197 * @tc.desc: Test ResConfig IsMoreSuitable
1198 * @tc.type: FUNC
1199 */
1200 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest042, TestSize.Level1)
1201 {
1202 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1203 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1204 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1205 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1206 request->SetDeviceType(DeviceType::DEVICE_PHONE);
1207 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1208 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1209 other->SetDeviceType(DeviceType::DEVICE_PHONE);
1210 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1211 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1212 delete request;
1213 delete current;
1214 delete other;
1215 }
1216
1217 /*
1218 * @tc.name: ResConfigImplIsMoreSuitableTest043
1219 * @tc.desc: Test ResConfig IsMoreSuitable
1220 * @tc.type: FUNC
1221 */
1222 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest043, TestSize.Level1)
1223 {
1224 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1225 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1226 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1227 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1228 request->SetDeviceType(DeviceType::DEVICE_PHONE);
1229 request->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1230 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1231 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1232 current->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1233 other->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1234 other->SetDeviceType(DeviceType::DEVICE_PHONE);
1235 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1236 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1237 delete request;
1238 delete current;
1239 delete other;
1240 }
1241
1242 /*
1243 * @tc.name: ResConfigImplIsMoreSuitableTest044
1244 * @tc.desc: Test ResConfig IsMoreSuitable
1245 * @tc.type: FUNC
1246 */
1247 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest044, TestSize.Level1)
1248 {
1249 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1250 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1251 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1252 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1253 request->SetDeviceType(DeviceType::DEVICE_PHONE);
1254 request->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1255 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1256 current->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1257 other->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1258 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1259 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1260 delete request;
1261 delete current;
1262 delete other;
1263 }
1264
1265 /*
1266 * @tc.name: ResConfigImplIsMoreSuitableTest045
1267 * @tc.desc: Test ResConfig IsMoreSuitable
1268 * @tc.type: FUNC
1269 */
1270 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest045, TestSize.Level1)
1271 {
1272 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1273 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1274 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1275 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1276 request->SetDeviceType(DeviceType::DEVICE_PHONE);
1277 request->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1278 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1279 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1280 current->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_XLDPI);
1281 other->SetDeviceType(DeviceType::DEVICE_PHONE);
1282 other->SetDirection(Direction::DIRECTION_HORIZONTAL);
1283 other->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_XXLDPI);
1284 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1285 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1286 delete request;
1287 delete current;
1288 delete other;
1289 }
1290
1291 /*
1292 * @tc.name: ResConfigImplIsMoreSuitableTest046
1293 * @tc.desc: Test ResConfig IsMoreSuitable
1294 * @tc.type: FUNC
1295 */
1296 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest046, TestSize.Level1)
1297 {
1298 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1299 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1300 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1301 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1302 request->SetDeviceType(DeviceType::DEVICE_PHONE);
1303 request->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1304 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1305 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1306 current->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_MDPI);
1307 other->SetDeviceType(DeviceType::DEVICE_PHONE);
1308 other->SetDirection(Direction::DIRECTION_HORIZONTAL);
1309 other->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_SDPI);
1310 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1311 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1312 delete request;
1313 delete current;
1314 delete other;
1315 }
1316
1317 /*
1318 * @tc.name: ResConfigImplIsMoreSuitableTest047
1319 * @tc.desc: Test ResConfig IsMoreSuitable
1320 * @tc.type: FUNC
1321 */
1322 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest047, TestSize.Level1)
1323 {
1324 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1325 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1326 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1327 request->SetDirection(Direction::DIRECTION_HORIZONTAL);
1328 request->SetDeviceType(DeviceType::DEVICE_PHONE);
1329 request->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_LDPI);
1330 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1331 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1332 current->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_XXXLDPI);
1333 other->SetDeviceType(DeviceType::DEVICE_PHONE);
1334 other->SetDirection(Direction::DIRECTION_HORIZONTAL);
1335 other->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_SDPI);
1336 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1337 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1338 delete request;
1339 delete current;
1340 delete other;
1341 }
1342
1343 /*
1344 * @tc.name: ResConfigImplIsMoreSuitableTest048
1345 * @tc.desc: Test ResConfig IsMoreSuitable
1346 * @tc.type: FUNC
1347 */
1348 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest048, TestSize.Level1)
1349 {
1350 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1351 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1352 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1353 current->SetDeviceType(DeviceType::DEVICE_PHONE);
1354 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1355 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1356 delete request;
1357 delete current;
1358 delete other;
1359 }
1360
1361 /*
1362 * @tc.name: ResConfigImplIsMoreSuitableTest049
1363 * @tc.desc: Test ResConfig IsMoreSuitable
1364 * @tc.type: FUNC
1365 */
1366 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest049, TestSize.Level1)
1367 {
1368 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1369 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1370 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1371 current->SetDirection(Direction::DIRECTION_HORIZONTAL);
1372 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1373 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1374 delete request;
1375 delete current;
1376 delete other;
1377 }
1378
1379 /*
1380 * @tc.name: ResConfigImplIsMoreSuitableTest050
1381 * @tc.desc: Test ResConfig IsMoreSuitable
1382 * @tc.type: FUNC
1383 */
1384 HWTEST_F(ResConfigImplTest, ResConfigImplIsMoreSuitableTest050, TestSize.Level1)
1385 {
1386 ResConfigImpl *request = CreateResConfigImpl("en", nullptr, "US");
1387 ResConfigImpl *current = CreateResConfigImpl("en", nullptr, "US");
1388 ResConfigImpl *other = CreateResConfigImpl("en", nullptr, "US");
1389 current->SetScreenDensity(ScreenDensity::SCREEN_DENSITY_SDPI);
1390 EXPECT_TRUE(current->IsMoreSuitable(other, request));
1391 EXPECT_FALSE(other->IsMoreSuitable(current, request));
1392 delete request;
1393 delete current;
1394 delete other;
1395 }
1396 }