14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License. 54514f5e3Sopenharmony_ci * You may obtain a copy of the License at 64514f5e3Sopenharmony_ci * 74514f5e3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84514f5e3Sopenharmony_ci * 94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and 134514f5e3Sopenharmony_ci * limitations under the License. 144514f5e3Sopenharmony_ci */ 154514f5e3Sopenharmony_ci 164514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_displaynames.h" 174514f5e3Sopenharmony_ci 184514f5e3Sopenharmony_ci#include "ecmascript/global_env.h" 194514f5e3Sopenharmony_ci#include "ecmascript/js_displaynames.h" 204514f5e3Sopenharmony_ci#include "ecmascript/tests/test_helper.h" 214514f5e3Sopenharmony_ci 224514f5e3Sopenharmony_ciusing namespace panda::ecmascript; 234514f5e3Sopenharmony_ciusing namespace panda::ecmascript::builtins; 244514f5e3Sopenharmony_cinamespace panda::test { 254514f5e3Sopenharmony_ciclass BuiltinsDisplayNamesTest : public BaseTestWithScope<true> { 264514f5e3Sopenharmony_ci}; 274514f5e3Sopenharmony_ci 284514f5e3Sopenharmony_cistatic JSTaggedValue JSDisplayNamesCreateWithOptionTest(JSThread *thread, JSHandle<JSTaggedValue> &locale, 294514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> &typeValue) 304514f5e3Sopenharmony_ci{ 314514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 324514f5e3Sopenharmony_ci JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); 334514f5e3Sopenharmony_ci JSHandle<JSFunction> newTarget(env->GetDisplayNamesFunction()); 344514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> objFun = env->GetObjectFunction(); 354514f5e3Sopenharmony_ci JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun); 364514f5e3Sopenharmony_ci 374514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeKey = thread->GlobalConstants()->GetHandledTypeString(); 384514f5e3Sopenharmony_ci JSObject::SetProperty(thread, optionsObj, typeKey, typeValue); 394514f5e3Sopenharmony_ci 404514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> localesString = locale; 414514f5e3Sopenharmony_ci std::vector<JSTaggedValue> args{localesString.GetTaggedValue(), optionsObj.GetTaggedValue()}; 424514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, newTarget, args, 8); 434514f5e3Sopenharmony_ci 444514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 454514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::DisplayNamesConstructor(ecmaRuntimeCallInfo); 464514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 474514f5e3Sopenharmony_ci 484514f5e3Sopenharmony_ci EXPECT_TRUE(result.IsJSDisplayNames()); 494514f5e3Sopenharmony_ci return result; 504514f5e3Sopenharmony_ci} 514514f5e3Sopenharmony_ci 524514f5e3Sopenharmony_ci// new DisplayNames(locales, options) 534514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, DisplayNamesConstructor) 544514f5e3Sopenharmony_ci{ 554514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 564514f5e3Sopenharmony_ci JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); 574514f5e3Sopenharmony_ci JSHandle<JSFunction> newTarget(env->GetDisplayNamesFunction()); 584514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> objFun = env->GetObjectFunction(); 594514f5e3Sopenharmony_ci 604514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeKey = thread->GlobalConstants()->GetHandledTypeString(); 614514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> styleKey = thread->GlobalConstants()->GetHandledStyleString(); 624514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> fallbackKey = thread->GlobalConstants()->GetHandledFallbackString(); 634514f5e3Sopenharmony_ci 644514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("en")); 654514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeValue(factory->NewFromASCII("language")); 664514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> styleValue(factory->NewFromASCII("narrow")); 674514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> fallbackValue(factory->NewFromASCII("code")); 684514f5e3Sopenharmony_ci 694514f5e3Sopenharmony_ci JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun); 704514f5e3Sopenharmony_ci JSObject::SetProperty(thread, optionsObj, typeKey, typeValue); 714514f5e3Sopenharmony_ci JSObject::SetProperty(thread, optionsObj, styleKey, styleValue); 724514f5e3Sopenharmony_ci JSObject::SetProperty(thread, optionsObj, fallbackKey, fallbackValue); 734514f5e3Sopenharmony_ci 744514f5e3Sopenharmony_ci std::vector<JSTaggedValue> args{localeString.GetTaggedValue(), optionsObj.GetTaggedValue()}; 754514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, newTarget, args, 8); 764514f5e3Sopenharmony_ci 774514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 784514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::DisplayNamesConstructor(ecmaRuntimeCallInfo); 794514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 804514f5e3Sopenharmony_ci EXPECT_TRUE(result.IsJSDisplayNames()); 814514f5e3Sopenharmony_ci} 824514f5e3Sopenharmony_ci 834514f5e3Sopenharmony_ci// Of(fr, type(language)) 844514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, Of_001) 854514f5e3Sopenharmony_ci{ 864514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 874514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> locale(factory->NewFromASCII("en")); 884514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeValue(factory->NewFromASCII("language")); 894514f5e3Sopenharmony_ci JSHandle<JSDisplayNames> jsDisplayNames = 904514f5e3Sopenharmony_ci JSHandle<JSDisplayNames>(thread, JSDisplayNamesCreateWithOptionTest(thread, locale, typeValue)); 914514f5e3Sopenharmony_ci 924514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> stringValue(factory->NewFromASCII("fr")); 934514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); 944514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); 954514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetThis(jsDisplayNames.GetTaggedValue()); 964514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(0, stringValue.GetTaggedValue()); 974514f5e3Sopenharmony_ci 984514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 994514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::Of(ecmaRuntimeCallInfo); 1004514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 1014514f5e3Sopenharmony_ci 1024514f5e3Sopenharmony_ci EXPECT_TRUE(result.IsString()); 1034514f5e3Sopenharmony_ci JSHandle<EcmaString> handleEcmaStr(thread, result); 1044514f5e3Sopenharmony_ci EXPECT_STREQ("French", EcmaStringAccessor(handleEcmaStr).ToCString().c_str()); 1054514f5e3Sopenharmony_ci} 1064514f5e3Sopenharmony_ci 1074514f5e3Sopenharmony_ci// Of(419, type(region)) 1084514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, Of_002) 1094514f5e3Sopenharmony_ci{ 1104514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 1114514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> locale(factory->NewFromASCII("en")); 1124514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeValue(factory->NewFromASCII("region")); 1134514f5e3Sopenharmony_ci JSHandle<JSDisplayNames> jsDisplayNames = 1144514f5e3Sopenharmony_ci JSHandle<JSDisplayNames>(thread, JSDisplayNamesCreateWithOptionTest(thread, locale, typeValue)); 1154514f5e3Sopenharmony_ci 1164514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> stringValue(factory->NewFromASCII("419")); 1174514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); 1184514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); 1194514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetThis(jsDisplayNames.GetTaggedValue()); 1204514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(0, stringValue.GetTaggedValue()); 1214514f5e3Sopenharmony_ci 1224514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 1234514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::Of(ecmaRuntimeCallInfo); 1244514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 1254514f5e3Sopenharmony_ci 1264514f5e3Sopenharmony_ci EXPECT_TRUE(result.IsString()); 1274514f5e3Sopenharmony_ci JSHandle<EcmaString> handleEcmaStr(thread, result); 1284514f5e3Sopenharmony_ci EXPECT_STREQ("Latin America", EcmaStringAccessor(handleEcmaStr).ToCString().c_str()); 1294514f5e3Sopenharmony_ci} 1304514f5e3Sopenharmony_ci 1314514f5e3Sopenharmony_ci// Of(EUR, type(currency)) 1324514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, Of_003) 1334514f5e3Sopenharmony_ci{ 1344514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 1354514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> locale(factory->NewFromASCII("en")); 1364514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeValue(factory->NewFromASCII("currency")); 1374514f5e3Sopenharmony_ci JSHandle<JSDisplayNames> jsDisplayNames = 1384514f5e3Sopenharmony_ci JSHandle<JSDisplayNames>(thread, JSDisplayNamesCreateWithOptionTest(thread, locale, typeValue)); 1394514f5e3Sopenharmony_ci 1404514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> stringValue(factory->NewFromASCII("EUR")); 1414514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); 1424514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); 1434514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetThis(jsDisplayNames.GetTaggedValue()); 1444514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(0, stringValue.GetTaggedValue()); 1454514f5e3Sopenharmony_ci 1464514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 1474514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::Of(ecmaRuntimeCallInfo); 1484514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 1494514f5e3Sopenharmony_ci 1504514f5e3Sopenharmony_ci EXPECT_TRUE(result.IsString()); 1514514f5e3Sopenharmony_ci JSHandle<EcmaString> handleEcmaStr(thread, result); 1524514f5e3Sopenharmony_ci EXPECT_STREQ("Euro", EcmaStringAccessor(handleEcmaStr).ToCString().c_str()); 1534514f5e3Sopenharmony_ci} 1544514f5e3Sopenharmony_ci 1554514f5e3Sopenharmony_ci// Of(Code Cover) 1564514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, Of_004) 1574514f5e3Sopenharmony_ci{ 1584514f5e3Sopenharmony_ci // IsNotJSDisplayNames 1594514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); 1604514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); 1614514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); 1624514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); 1634514f5e3Sopenharmony_ci 1644514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 1654514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::Of(ecmaRuntimeCallInfo); 1664514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 1674514f5e3Sopenharmony_ci EXPECT_TRUE(thread->HasPendingException()); 1684514f5e3Sopenharmony_ci EXPECT_EQ(result, JSTaggedValue::Exception()); 1694514f5e3Sopenharmony_ci thread->ClearException(); 1704514f5e3Sopenharmony_ci} 1714514f5e3Sopenharmony_ci 1724514f5e3Sopenharmony_ci// SupportedLocalesOf("best fit") 1734514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, SupportedLocalesOf_001) 1744514f5e3Sopenharmony_ci{ 1754514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 1764514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> locale(factory->NewFromASCII("id-u-co-pinyin-de-ID")); 1774514f5e3Sopenharmony_ci 1784514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); 1794514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); 1804514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); 1814514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(0, locale.GetTaggedValue()); 1824514f5e3Sopenharmony_ci // set the tag is default value 1834514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); 1844514f5e3Sopenharmony_ci 1854514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 1864514f5e3Sopenharmony_ci JSTaggedValue resultArr = BuiltinsDisplayNames::SupportedLocalesOf(ecmaRuntimeCallInfo); 1874514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 1884514f5e3Sopenharmony_ci 1894514f5e3Sopenharmony_ci JSHandle<JSArray> resultHandle(thread, resultArr); 1904514f5e3Sopenharmony_ci JSHandle<TaggedArray> elements(thread, resultHandle->GetElements()); 1914514f5e3Sopenharmony_ci EXPECT_EQ(elements->GetLength(), 1U); 1924514f5e3Sopenharmony_ci JSHandle<EcmaString> handleEcmaStr(thread, elements->Get(0)); 1934514f5e3Sopenharmony_ci EXPECT_STREQ("id-u-co-pinyin-de-id", EcmaStringAccessor(handleEcmaStr).ToCString().c_str()); 1944514f5e3Sopenharmony_ci} 1954514f5e3Sopenharmony_ci 1964514f5e3Sopenharmony_ci// SupportedLocalesOf("look up") 1974514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, SupportedLocalesOf_002) 1984514f5e3Sopenharmony_ci{ 1994514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 2004514f5e3Sopenharmony_ci JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); 2014514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> objFun = env->GetObjectFunction(); 2024514f5e3Sopenharmony_ci 2034514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> localeMatcherKey = thread->GlobalConstants()->GetHandledLocaleMatcherString(); 2044514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> localeMatcherValue(factory->NewFromASCII("lookup")); 2054514f5e3Sopenharmony_ci JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun); 2064514f5e3Sopenharmony_ci JSObject::SetProperty(thread, optionsObj, localeMatcherKey, localeMatcherValue); 2074514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> locale(factory->NewFromASCII("de-DE-u-co-phonebk")); 2084514f5e3Sopenharmony_ci 2094514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); 2104514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); 2114514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); 2124514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(0, locale.GetTaggedValue()); 2134514f5e3Sopenharmony_ci ecmaRuntimeCallInfo->SetCallArg(1, optionsObj.GetTaggedValue()); 2144514f5e3Sopenharmony_ci 2154514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 2164514f5e3Sopenharmony_ci JSTaggedValue resultArr = BuiltinsDisplayNames::SupportedLocalesOf(ecmaRuntimeCallInfo); 2174514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 2184514f5e3Sopenharmony_ci 2194514f5e3Sopenharmony_ci JSHandle<JSArray> resultHandle(thread, resultArr); 2204514f5e3Sopenharmony_ci JSHandle<TaggedArray> elements(thread, resultHandle->GetElements()); 2214514f5e3Sopenharmony_ci EXPECT_EQ(elements->GetLength(), 1U); 2224514f5e3Sopenharmony_ci JSHandle<EcmaString> handleEcmaStr(thread, elements->Get(0)); 2234514f5e3Sopenharmony_ci EXPECT_STREQ("de-DE-u-co-phonebk", EcmaStringAccessor(handleEcmaStr).ToCString().c_str()); 2244514f5e3Sopenharmony_ci} 2254514f5e3Sopenharmony_ci 2264514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsDisplayNamesTest, ResolvedOptions) 2274514f5e3Sopenharmony_ci{ 2284514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 2294514f5e3Sopenharmony_ci auto globalConst = thread->GlobalConstants(); 2304514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> locale(factory->NewFromASCII("de-DE")); 2314514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeValue(factory->NewFromASCII("currency")); 2324514f5e3Sopenharmony_ci JSHandle<JSDisplayNames> jsDisplayNames = 2334514f5e3Sopenharmony_ci JSHandle<JSDisplayNames>(thread, JSDisplayNamesCreateWithOptionTest( 2344514f5e3Sopenharmony_ci thread, locale, typeValue)); 2354514f5e3Sopenharmony_ci std::vector<JSTaggedValue> args{}; 2364514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, args, 4, jsDisplayNames.GetTaggedValue()); 2374514f5e3Sopenharmony_ci 2384514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo); 2394514f5e3Sopenharmony_ci JSTaggedValue result = BuiltinsDisplayNames::ResolvedOptions(ecmaRuntimeCallInfo); 2404514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 2414514f5e3Sopenharmony_ci 2424514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> resultObj = 2434514f5e3Sopenharmony_ci JSHandle<JSTaggedValue>(thread, JSTaggedValue(static_cast<JSTaggedType>(result.GetRawData()))); 2444514f5e3Sopenharmony_ci // judge whether the properties of the object are the same as those of jsdatetimeformat tag 2454514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> localeKey = globalConst->GetHandledLocaleString(); 2464514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> localeValue(factory->NewFromASCII("de-DE")); 2474514f5e3Sopenharmony_ci EXPECT_EQ(JSTaggedValue::SameValue( 2484514f5e3Sopenharmony_ci JSObject::GetProperty(thread, resultObj, localeKey).GetValue(), localeValue), true); 2494514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> typeKey = globalConst->GetHandledTypeString(); 2504514f5e3Sopenharmony_ci EXPECT_EQ(JSTaggedValue::SameValue( 2514514f5e3Sopenharmony_ci JSObject::GetProperty(thread, resultObj, typeKey).GetValue(), typeValue), true); 2524514f5e3Sopenharmony_ci} 2534514f5e3Sopenharmony_ci} 254