diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets index b413cc63f7a328c1089ee8c31811f62749bab0c2..ee39670a226acff96e085e6db9f8370b24c7bb16 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets @@ -14,7 +14,7 @@ */ import Log from '../common/Log.ets'; - +import events_emitter from '@ohos.events.emitter'; const TAG = 'ets_apiLack_add'; @Entry @@ -118,7 +118,26 @@ export default struct CommonColorMode { .textOverflow({ overflow: TextOverflow.None }) .key("areaText") .onClick((event) => { - Log.showInfo(TAG, 'area: ' + JSON.stringify(event.target.area)) + Log.showInfo(TAG, 'JSON.stringify area : ' + JSON.stringify(event.target.area)) + const area = JSON.stringify(event.target.area) + console.info("area value is: " + area) + console.info("area.position value is: " + area.position) + console.info("area.position value is: " + area.position.x) + try { + var backData = { + data: { + "STATUS": area + } + } + let backEvent = { + eventId: 60312, + priority: events_emitter.EventPriority.LOW + } + console.info("areaValue start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("areaValue emit action state err: " + JSON.stringify(err.message)) + } }) Text("common-Repeat") .width(320) @@ -263,6 +282,23 @@ export default struct CommonColorMode { .key("touchesText") .onTouch((event) => { Log.showInfo(TAG, 'touches: ' + JSON.stringify(event.touches)) + const touches = JSON.stringify(event.touches) + const touchesValue = JSON.parse(touches) + try { + var backData1 = { + data: { + "STATUS": touchesValue + } + } + let backEvent1 = { + eventId: 60313, + priority: events_emitter.EventPriority.LOW + } + console.info("touchesValue start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (err) { + console.info("touchesValue emit action state err: " + JSON.stringify(err.message)) + } }) Text("common-ChangedTouches") @@ -280,6 +316,23 @@ export default struct CommonColorMode { .key("changedTouchesText") .onTouch((event) => { Log.showInfo(TAG, 'changedTouches: ' + JSON.stringify(event.changedTouches)) + const changedTouches = JSON.stringify(event.changedTouches) + const changedTouchesValue = JSON.parse(changedTouches) + try { + var backData2 = { + data: { + "STATUS": changedTouches + } + } + let backEvent2 = { + eventId: 60314, + priority: events_emitter.EventPriority.LOW + } + console.info("touchesValue start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (err) { + console.info("touchesValue emit action state err: " + JSON.stringify(err.message)) + } }) Text("common-KeyCode") diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets index 45ccbfd3369b972d510145699d07a49c42414845..674ff335a83e85fb138ec638360dc15a5fa7987a 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets @@ -23,6 +23,7 @@ import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets'; import checkBoxGroupJsunit from './checkBox.test.ets'; import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets'; import commonColorModeJsunit from './common.test.ets'; +import configurationApiTest from './configuration.test.ets' import datePickerLunarJsunit from './datePicker.test.ets'; import enumsCancelJsunit from './enums.test.ets'; import gestureParallelJsunit from './gesture.test.ets'; @@ -45,9 +46,7 @@ import copyOptionJsunit from './copyOption.test.ets'; export default function testsuite() { animatorOnframeJsunit() - curvesEaseOutJsunit() routerStandardJsunit() - uiAppearanceALWAYS_DARKJsunit() appVersionCodeJsunit() alertDialogCenterStartJsunit() canvasActualBoundingBoxAscentJsunit() @@ -55,13 +54,11 @@ export default function testsuite() { checkBoxGroupPartJsunit() commonColorModeJsunit() datePickerLunarJsunit() - enumsCancelJsunit() gestureParallelJsunit() listtestIdleJsunit() loadingProgressCircularJsunit() progressScaleCountJsunit() radioGroupJsunit() - refreshDragJsunit() sidebarIconsJsunit() sliderMovingJsunit() stateManagementDARKJsunit() diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..64aaffafee02cc5fa76e1c3d32a42a24acdf8466 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets @@ -0,0 +1,51 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import configuration from '@system.configuration'; +import router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets' + +export default function configurationApiTest() { + describe('configurationApiTest', function () { + beforeEach(async function (done) { + await Utils.sleep(1000); + console.info("appVersionCode after each called"); + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("appVersionCode after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name colorMode001 + * @tc.desic aceColorMode001EtsTest0001 + */ + it('colorMode001', 0, async function (done) { + console.info('colorMode001 test START'); + const localeInfo = configuration.getLocale(); + console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo)); + console.info("[configuration.getLocale] colorMode: " + localeInfo.colorMode); + console.info("[configuration.getLocale] fontScale: " + localeInfo.fontScale); + expect(localeInfo.colorMode).assertEqual('COLOR_MODE_LIGHT'); + expect(localeInfo.fontScale).assertEqual('ltr'); + console.info('testConfigurationGetLocale END'); + }); + }) +}